Skip to content

Instantly share code, notes, and snippets.

@ysyun
Created April 14, 2013 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysyun/5382540 to your computer and use it in GitHub Desktop.
Save ysyun/5382540 to your computer and use it in GitHub Desktop.
AngularJS Local Scope Property Sample
/*
local scope property
<div ng-app="drinkApp">
<div ng-controller="AppCtrl">
<div drink flavor="strawberry"></div>
</div>
</div>*/
var app = angular.module("drinkApp", []);
app.controller("AppCtrl", function($scope) {
$scope.ctrlFlavor = "blackberry";
})
app.directive("drink", function() {
return {
scope: {
flavor: "@"
},
template: '<div>{{flavor}}</div>'
/*
scope: {flavor: "@"}
===
link: function(scope, element, attrs) {
scope.flavor = attrs.flavor;
}*/
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment