我已經定義了這種狀態:如何訪問狀態視圖的自定義屬性?
.state('app.feedback', {
url: '/feedback',
views: {
'appContent': {
templateUrl: 'templates/feedback.html',
controller: 'feedbackCtrl',
customParameter: 'This is my Name'
}
}
})
我要表明customParameter
上appContent
。
這是我的控制器:
.controller('feedbackCtrl',
['$scope', '$log', '$state',
function($scope, $log, $state) {
$scope.customParameter = $state.current.customParameter;
}]);
,這是我的看法:
<ion-view view-title="{{customParameter}}">
<ion-content>
<h1>{{customParameter}}</h1>
</ion-content>
</ion-view>
沒有大幹快上的觀點表明,當我對國家的聲明中使用自定義的參數,而視圖對象它工作,但我需要在這個項目中有幾個意見。我如何訪問該自定義參數?
PS:我與離子的工作1.3.1
實際上,當我看到$ stateParams對象是空的,我認爲它只適用於URL製作參數。 – distante