I am the scope property of the directive
It works fine when I use show as the name attr.
<span ng-repeat="field in fields"> <field-pill field="field" show="true"></field-pill> </span>
app.js
angular.module('app',[]); angular.module('app') .controller('AppCtrl', function($scope){ $scope.fields = [1,2,3,4]; }); angular.module('app') .directive('fieldPill', function () { return { template: '<div class="pill">{{field}}:{{show}}--<span ng-show="show">x</span></div>', restrict: 'E', scope:{ field: "=", "show": "=" } }; });
(see this plunkr http://plnkr.co/edit/AcqmxeCerCOtGaw9dq9t?p=preview )
But the directive does not load logical data at all when I use x-show as the attribute name.
<span ng-repeat="field in fields"> <field-pill field="field" x-show="true"></field-pill> </span>
app.js
angular.module('app',[]); angular.module('app') .controller('AppCtrl', function($scope){ $scope.fields = [1,2,3,4]; }); angular.module('app') .directive('fieldPill', function () { return { template: '<div class="pill">{{field}}:{{xShow}}--<span ng-show="xShow">x</span></div>', restrict: 'E', scope:{ field: "=", xShow: "=" } }; });
Can someone explain why?
(see this plunkr for code with x-show http://plnkr.co/edit/2txoY3VaShH6WggnugcE?p=preview )