我有一個視圖與控制器名稱"Listctrl"
在這個視圖中我想有一個不同的控制器命名爲"LocationCtrl"
。目前,我這樣做是這樣的:使用多個控制器在同一視圖與離子
路由
.state('list', {
url: '/list',
templateUrl: 'templates/list.html',
controller: "ListCtrl",
cache: false
})
HTML(list.html)
<ion-view ng-init="ini()" ng-controller="LocationCtrl">
<ion-header-bar class="banner-top ext-box" align-title-h="left">
<div class="int-box2"><h2 id="s_back1">STORIE</h2></div>
</ion-header-bar>
<ion-content class="has-header has-footer no-bgColor start" overflow-scroll="false" has-bouncing="false">
<div class="container-list">
我應該如何正確地解決這個問題?我需要兩個控制器用於相同的視圖,但在不同的地方,因爲我想在不同的視圖中重用控制器代碼。
目前<ion-view ng-init="ini()" ng-controller="LocationCtrl">
不運行LocationCtrl
任何幫助,非常感謝!
這並不完全合理。 「一個觀點的兩個控制器」甚至意味着什麼?你(或框架)如何能夠區分? – Claies