I'm learning angulaJS by the video Introduction to Angular.js in 50 Examples , it's awesome but I'm confused since #46. We, say, want to get some nation's information from json file and display it, and we have a directive definition:
countryApp.directive('country', function () {
return {
scope: {
country: '=country'
},
restrict: 'A',
templateUrl: 'country.html'
};
});
and we invoke the directive country in some html:
<ul>
<li ng-repeat="country in countries" country="country"></li>
</ul>
My question is: what the exact meaning of 4 different nouns "country" is? the first two in directive scope(country: '=country' ), the last two in html(country="country"). I understand the first one is just a variable definition in directive, so it should be change to another name such as dir_country, but it can't work !
lielement is wrapped in a controller? The directive is receiving the country that would have been populated by the parent controller of the element_ - :in attributes are converted to camelCase like dirCountry in angular.