angular expression working inside a script tag

戏子无情 提交于 2019-12-02 10:39:34

There is nothing special wrt use of AngularJS expressions inside partial templates.

As already said your model is actually array - so you'll have to iterate through the items using ng-repeat like this:

<ul>
    <li ng-repeat="card in cards">
        Card id: {{card.id}}
        Card title: {{card.title}}
        Card details: {{card.details}}
    </li>
</ul>

Please see working JSFiddle example.

Here is an example how you can use your template:

<div ng-include src="'modal-2.html'"></div>

or use it with a button:

<button ng-click="currentTpl='modal-2.html'">Show Modal</button>
<div ng-include src="currentTpl"></div>

The expression in the template then works as is usual.
Here is an example.

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