Angularjs 离子路由-启动视图
我试图学习ionic框架,我一直在阅读路由方面的内容,这是我有点卡住了 我的应用程序正常工作,但现在我想添加更多视图。因此,我首先将我的主视图置于一个名为“home”的状态(如果我没有使用正确的术语,很抱歉) 好的,这是我的html:Angularjs 离子路由-启动视图,angularjs,angular-ui-router,ionic,Angularjs,Angular Ui Router,Ionic,我试图学习ionic框架,我一直在阅读路由方面的内容,这是我有点卡住了 我的应用程序正常工作,但现在我想添加更多视图。因此,我首先将我的主视图置于一个名为“home”的状态(如果我没有使用正确的术语,很抱歉) 好的,这是我的html: <!DOCTYPE html> <html ng-app="ionic.example"> <head> <meta charset="utf-8"> <title>Venu
<!DOCTYPE html>
<html ng-app="ionic.example">
<head>
<meta charset="utf-8">
<title>Venues</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<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-pane>
<ion-header-bar class="bar-positive">
<div class="buttons">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left"></button>
</div>
<h1 class="title">Venues</h1>
</ion-header-bar>
<ion-nav-view></ion-nav-view>
<ion-view nng-controller="MyCtrl" title="home">
<ion-content class="has-header">
<ion-list>
<ion-item ng-repeat="item in items">
<a href="#/venue/{{ item[0].id }}">
<div class="list card">
<div class="item item-avatar">
<img src="{{ item[0].profile_pic }}">
<h2 class="item-venue-title">{{ item[0].name }}</h2>
<p class="item-location">UK</p>
</div>
<div class="item item-body">
<img class="full-image" src="{{ item[0].heder_img }}">
</div>
</a>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item" href="#">
<i class="icon ion-thumbsup"></i>
Like
</a>
<a class="tab-item" href="#">
<i class="icon ion-chatbox"></i>
Comment
</a>
<a class="tab-item" href="#">
<i class="icon ion-share"></i>
Share
</a>
</div>
</div>
</ion-item>
</ion-list>
<ion-infinite-scroll on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>
</ion-content>
</ion-view>
<nav class="tabs tabs-icon-bottom tabs-positive">
<a class="tab-item">
Clean
<i class="icon ion-waterdrop"></i>
</a>
<a class="tab-item">
Security
<i class="icon ion-locked"></i>
</a>
<a class="tab-item has-badge">
Light
<i class="badge">3</i>
<i class="icon ion-leaf"></i>
</a>
<a class="tab-item">
Clean
<i class="icon ion-waterdrop"></i>
</a>
</nav>
</ion-pane>
</body>
</html>
我不明白的是,你怎么说这是所谓的“第一”观点
如有任何建议,将不胜感激。本节
$urlRouterProvider.otherwise('/home');
将定义索引路由,因此在本例中/home将是第一页。
home.html的内容在ion nav视图中呈现,见下文
<body ng-app="quote">
<!-- where the initial view template will be rendered -->
<div ng-controller="AppCtrl">
<ion-nav-view></ion-nav-view>
</div>
</body>
<ion-view title="your title">
<ion-content>
your content here
</ion-content>
</ion-view>
home.html的内容放在ion内容标签中,见下文
<body ng-app="quote">
<!-- where the initial view template will be rendered -->
<div ng-controller="AppCtrl">
<ion-nav-view></ion-nav-view>
</div>
</body>
<ion-view title="your title">
<ion-content>
your content here
</ion-content>
</ion-view>
你的内容在这里
我自己做的
<script type="text/ng-template" id="home.html">
<ion-view nng-controller="MyCtrl" title="home">
<!--content here--!>
</ion-view>
</script>
我需要用下面的标签来包装它吗?请看编辑后的答案,因为它在评论中显示得不好