Knockout's writable computed observable in AngularJS(Not In Ng-model)
Knockout's writable computed observable in AngularJS(Not In Ng-model)
by manoj
HTML
<div ng-app>
<div ng-controller="Ctrl">
<input type="text" ng-model="firstName"/>
<input type="text" ng-model="lastName"/>
<input type="text" ng-model="fullName"/>
<ul>
<li>{{firstName}}</li>
<li>{{lastName}}</li>
<li>{{fullName()}}</li>
</ul>
</div>
</div>
JavaScript
function Ctrl($scope){
$scope.firstName = 'mano';
$scope.lastName = 's';
$scope.fullName = function(){
return $scope.lastName ? $scope.firstName+' '+$scope.lastName : $scope.firstName;
}
}