我无法在 Ionic 页面中获取内容和标题标题。让我知道我做错了什么。
预计会有一个带有左右按钮和一些内容的正栏标题,但它完全空白,控制台中也没有 JS 错误。
index.html
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>
app.js -
.state('signup', {
url: '/signup',
views: {
'signup': {
templateUrl: 'templates/signup.html'
}
}
})
signup.html -
<ion-header-bar align-title="left" class="bar-positive">
<div class="buttons">
<button class="button">Left Button</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
<ion-content>
Some content! Some content! Some content! Some content! Some content! Some content! Some content! Some content!
</ion-content>
最佳答案
您的状态配置 signup
查找名为 signup
的命名 View (在 views
对象下)但是你的 <ion-nav-view>
不是一个有名字的人。您可以通过添加 name
来解决此问题属性为<ion-nav-view>
像下面这样。
<ion-nav-view name="signup"></ion-nav-view>
(或者)如果您确定始终有一个 View 需要更新,则可以从您的状态中删除命名 View 定义。
.state('signup', {
url: '/signup',
templateUrl: 'templates/signup.html'
});
关于javascript - 无法查看 ion-content ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34751302/