Inserting directives into HTML in AngularJS?

孤人 提交于 2019-12-05 09:14:17

Here's a quick demo: http://plnkr.co/edit/eZTtRVTPb7k9kgS8woKh?p=preview

I don't necessarily see the need for directives here ... unless there is a lot of common functionality between feature in the list, the maximized feature, and the minimized feature.

If you really do have lots of common functionality between the three lists, you could do something like this:

<feature ng-repeat="f in registry.all()" model="f" state="list">
<feature ng-repeat="f in registry.maximized()" model="f" state="open">
<feature ng-repeat="f in registry.minimized()" model="f" state="minimized">

Then in your directive template, you could have your common functionality then determine what to have depending on the state using ng-switch or ng-show.

Do you need help writing the actual directive?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!