angularjs-1.5

How to eval an attribute as string which is a custom function using Angular 1.5 component?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:36:20
问题 I'm using Angular 1.5. I created a menu which is a component. The menu component accept as attribute a list of jsonObject to create each menuitem. <comp-menu items="menuitems" ></comp-menu> A menuitem is a component as well. I would like to add an attribute like "action" which would be a custom function as an evaluated string in data-ng-click... of this kind : <comp-menuitem data-ng-repeat="item in items" data-ng-click="eval({{item.action}})"></comp-menuitem> The data can be like in my

Force scope to named slot with ng-transclude

自古美人都是妖i 提交于 2019-12-11 13:08:37
问题 I've a directive as follows: <selectable-item-list items="model.items"> <item-template> <span ng-bind="item.text"></span> </item-template> </selectable-item-list> The issue is in the <item-template> , where item would be a reference of currently iterated item when an internal ng-repeat is bound inside <selectable-item-list> . AFAIK, it seems like transclusions can't see directive's scope, thus, that item.text can't be bound because there's no item at all. How would you solve this scenario?

Condition in ng- class not working

最后都变了- 提交于 2019-12-08 21:24:30
AngularJS I have scenario of applying class based on a condition in which I'm storing the value in rootscope dynamically and evaluating in html angular expression but still not working <li role="presentation" style="width:200px" ng-class="{active: true, inactive: false}[{{vm.$rootScope.currentPage}}==1]"><a href="#/create">Create</a></li> In inspect element if I check I can see 1==1 but still class is not getting active and if I remove {{vm.$rootScope.currentPage}} and place 1 it is working I tried this also <li role="presentation" style="width:200px" ng-class="{'active':2=={{vm.$rootScope