有没有办法区分两个不同的内联模板并单独引用它们?
例如
<script type="text/ng-template" id="/home.html">
<div class="page-header">
<h1>Flapper News</h1>
</div>
<!-- rest of template -->
</script>
<!--Post-->
<script type="text/ng-template" id="/posts.html">
<div class="page-header">
<h3>
<a ng-show="post.link" href="{{post.link}}">
{{post.title}}
</a>
<span ng-hide="post.link">
{{post.title}}
</span>
</h3>
</div>
<div ng-repeat="comment in post.comments | orderBy:'-upvotes'">
<span class="glyphicon glyphicon-thumbs-up"
ng-click="incrementUpvotes(comment)">
</span>
{{comment.upvotes}} - by {{comment.author}}
<span style="font-size:20px; margin-left:10px;">
{{comment.body}}
</span>
</div>
<form ng-submit="addComment()"
style="margin-top:30px;">
<h3>Add a new comment</h3>
<div class="form-group">
<input type="text"
class="form-control"
placeholder="Comment"
ng-model="body">
</input>
</div>
<button type="submit" class="btn btn-primary">Post</button>
</form>
</script>
我只知道如何使用
在html中引用内联模板<ui-view></ui-view>
然而ui-view
引用了两个模板并且无法区分这两个模板,有没有办法绕过它?
以下是一些功能代码https://gist.github.com/anonymous/cafcf0765ea412635042
由于