Sayfa başlığını dinamik olarak güncellemeye çalışıyorum.
<title page-title></title>
to the documentation, I am supposed to be able to access my custom data property göre:: Sayfa BAŞ bölümünde
$stateProvider.state('login', {
url: '/login',
templateUrl: '/templates/views/login.html',
controller: 'AuthCtrl',
data: {title: 'Log in'}
}
:
app.directive("pageTitle", function ($state) {
return {
restrict: 'A',
template: "{{title}}",
scope: {},
link: function (scope, elem, attr) {
scope.title=$state.current.data.title; //wrap this in $watch
console.log('page state',$state.current.data.title);
}
}
});
Ama bu undefined
döndürür
Ah, harika bir açıklama. Teşekkür ederim. – metalaureate
FYI Bunu bir kapsamda sarmak zorunda kaldım. Güncellenmesi için $ watch. – metalaureate