我的index.html
包含以下元素
...
<div class="col-md-6" ng-bind-html='module.docs.html'></div>
...
module.docs.html
属性返回HTML,如
<div ng-controller="accordion-demo-ctrl">
<label class="checkbox">
<input type="checkbox" ng-model="oneAtATime">
Open only one at a time
</label>
<accordion close-others="oneAtATime">
<accordion-group heading="Static Header, initially expanded" is-open="true">
This content is straight in the template.
</accordion-group>
<accordion-group heading="{{group.title}}" ng-repeat="group in groups">
{{group.content}}
</accordion-group>
<accordion-group heading="Dynamic Body Content">
<p>The body of the accordion group grows to fit the contents</p>
<button class="btn btn-default btn-sm" ng-click="addItem()">Add Item</button>
<div ng-repeat="item in items">{{item}}</div>
</accordion-group>
<accordion-group is-open="isopen">
<accordion-heading>
I can have markup, too! <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
This is just some content to illustrate fancy headings.
</accordion-group>
</accordion>
</div>
插入了HTML但Angular.dart似乎没有对它做任何事情(accordion-demo-ctrl
没有实例化)
答案 0 :(得分:0)
使用ng-include
指令有效。
我更改了代码,以便提供HTML片段的URI而不是源本身(无论如何从服务器获取)。
另请参阅我对How to add a component programatically in Angular.Dart?的替代解决方案的回答