JSFiddle - React, Tailwind, and code Playground

by shushanth pallegar

HTML

<div ng-app="myApp" ng-controller="myCtrl">
    This is from controller:
    <input type="text" ng-model="gdrink" />
    
    This is from directive:
    
    <div get-drink drink="gdrink"></div>
    
    
</div>

JavaScript

var app = angular.module('myApp',[]);

app.controller('myCtrl',['$scope',function($scope){
   
    $scope.gdrink = "vodka";

}]);

app.directive('getDrink',function(){
  
    return {
    
        restrict:'A',
        scope:{
            drink:'='
        },
        template:'<input type="text" ng-model="drink"/>'
    
    }

});