gpt4 book ai didi

angularjs - ionic - ionic View 标题不起作用

转载 作者:行者123 更新时间:2023-12-04 16:25:51 26 4
gpt4 key购买 nike

我正在关注网站上的一些示例,我当前的 html 是:

<!DOCTYPE html>
<html ng-app="Test">

<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
</head>

<body>
<ion-nav-bar class="bar-positive">
<ion-nav-back-button class="button-icon ion-arrow-left-c">
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view>
<!-- Center content -->
</ion-nav-view>

<script type="text/ng-template" id="main.html">
<ion-view view-title="Home">
<ion-content >
<p>
Test
</p>
</ion-content>
</ion-view>
</script>
</body>

</html>

和js:
var app = angular.module('Test', ['ionic']);

app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/')

$stateProvider.state('index', {
url: '/',
templateUrl: 'main.html',
controller: 'TestCtrl'

})
})

app.controller('TestCtrl', function($scope) {

})

现在文档说 view-title="Test"应该在 ion-navbar 中填写标题。但它似乎不起作用。有谁知道出了什么问题?

最佳答案

似乎两种方式都可以使用,

<ion-view view-title="My Page">

或者
<ion-nav-title>
{{page.title}}
</ion-nav-title>

根据最新版本的 ionic 。
http://ionicframework.com/docs/api/directive/ionView/
http://ionicframework.com/docs/api/directive/ionNavTitle/

关于angularjs - ionic - ionic View 标题不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27060407/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com