Ich möchte Titel dynamisch erhalten. Wie teile ich $ scope.title in indexCtrl?AngularJS: Wie kann ich Daten über Controller hinweg austauschen?
var app = angular.module('app', []);
app.controller('firstCtrl', function($scope){
$scope.title = 'OneFC';
})
app.controller('secondCtrl', function($scope){
$scope.title = 'UFC';
})
app.controller('indexCtrl', function(){
// i want to get the title here depends on the active state in ui-router.
}
Versucht es, aber kein Glück. –
Up Ihren Code zu plunkr, so können wir sehen, warum Sie "kein Glück" –
https://plnkr.co/edit/hGHC5mQSitee5957rZZC?p=preview –