Alainlb, . , , , , template :'<span>name:{{event.name}} ,age:{{event.age}} , height:{{event.height}} </span>' ( {{ ... }} ).
, , - . , , , :
function link(scope, element, attrs) {
scope.$watch('event', function(ev) {
element.text('name:' + ev.name + ', age:' + ev.age + ' , height:' + ev.height);
}, true);
}
http://plnkr.co/edit/marpxMx5qin7mOlFwp3X?p=preview
: 201
; , = . , scope: {} ; , , - . scope: false ( 1 scope , ).
, my-event:
.directive('myEvent', function() {
return {
scope: false,
link: link,
};
function link(scope, element, attrs) {
scope.$watch(
attrs.myEvent,
function(ev) {
element.text('name:' + ev.name + ', age:' + ev.age + ' , height:' + ev.height);
},
true
);
}
});
http://plnkr.co/edit/lvnIQCJMnniFlOeRseaZ?p=preview
: 101
: , , . , , - 101 301 . ?
, 101 301 . , . "" Javascript , , . .
( - ) . :
vm.c10 = function (){
this.arr[4] = {
name: "aaaa",
age: "aaaa",
height: "aaaa"
};
};
( , true scope.$watch). , , (Immutable.js -?), ( ) . , .