function AppViewModel( ){
this.firstName = ko.observable( 'Bert' )
this.lastName = ko.observable( 'Bertington' )
this.fullName = ko.computed( function( ){
return this.firstName() + ' ' + this.lastName()
}, this )
}
function AppViewModel( $scope ){
$scope.firstName = 'Bert'
$scope.lastName = 'Bertington'
$scope.fullName = ''
$scope.$watch( function( ){
return $scope.firstName + ' ' + $scope.lastName
}, function( next ){
this.fullName = next
})
}
$foo.app.view = function( ){ }
$jin.atom.prop(
{ '$foo.app.view..firstName': { value: 'Bert' }
, '$foo.app.view..lastName': { value: 'Bertington' } })
, '$foo.app.view..fullName': {
pull: function( ){
return this.firstName() + ' ' + this.lastName()
}
}
})
<ul data-bind="foreach: names()">
<li data-bind="text: $data"></li>
</ul>
Шаблон завязан на фиксированный формат данных.
<ul ng-repeat="name in names">
<li>{{name}}</li>
</ul>
Шаблон завязан на фиксированный формат данных.
<ul MyFriends-list="{id}">{friends}</ul>
<li MyFriends-item="{id}">{name}</li>
Шаблон предостовляет слоты, в которые можно поместить любые данные.