directive with '@'

by shushanth pallegar

HTML

<div ng-app="myApp" ng-controller="myCtrl">
    
     <div drink name="vodka" price="{{price}}"></div>  
     
    
</div>

JavaScript

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

app.controller('myCtrl',['$scope',function($scope){

       $scope.price = "100$";
       
   

}]);


app.directive('drink',function(){

    return {
        restrict:'A',
        scope:{
            name:'@',
            price:'@'
         
        },
        template:'<div>{{name}}</div><p>{{price}}</p>'
    
    }


})