我使用下面的代码并获得了原始html结果。我看到{{welcome}}等的表达。我想我在某处做错了,导致它无法呈现。但我在Chrome的控制台中没有看到任何错误。
我app.js
app.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('threadListing', {
url: '/',
templateUrl: 'threadListing.html',
controller: 'AppCtrl'
})
.state('threadDetail.php', {
url: '/threadDetail',
templateUrl: 'threadDetail.html',
controller: 'AppCtrl'
})
$urlRouterProvider.otherwise("/");
})
我的HTML是这样
<ion-content>
<script id="threadListing.html" type="text/ng-template">
<ion-view>
<h1>Welcome {{name}}</h1>
</ion-view>
</script>
<script id="threadDetail.html" type="text/ng-template">
<ion-view>
<h2>{{age}}</h2>
</ion-view>
</script>
</ion-content>
是离子含量指令?我不认为你可以在指令中包装脚本标签,并且仍然期望它作为路由的模板。 – nimrod 2014-12-02 01:38:53
@nimrod我参考这个http://codepen.io/mhartington/pen/CAxFG – mike19911 2014-12-02 03:47:48