AngularJS Direktiven 'link
Funktion ändern isolieren Scope-Daten nicht in UI wider. Hier
ein Beispiel:
var myApp = angular.module('myApp', []);
myApp.directive('myDirective', function() {
return {
restrict: 'A',
template: '<span>Title: {{myParams.title}}</span>',
scope: {
myParams: '='
},
link: function ($scope) {
// the new value is not reflected in ui
$scope.myParams.title = 'this is myDirective';
}
};
});
HTML:
<div my-directive my-params="{title: 'this is title'}"></div>
ich die HTML-Seite will this is myDirective
angezeigt werden, aber in der Tat ist es this is title
.
Darüber hinaus könnten Sie erklären, warum es so angezeigt wird. Danke
was ist das 'my-params'? –