The largest Interview Solution Library on the web



Warning: include(../../menu/leftMenu/angularjswatchandpush.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-watchandpush.php on line 36

Warning: include(../../menu/leftMenu/angularjswatchandpush.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-watchandpush.php on line 36

Warning: include() [function.include]: Failed opening '../../menu/leftMenu/angularjswatchandpush.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/javatech/public_html/question/angularjsexample/angularjs-watchandpush.php on line 36
« Previous | 1 | 2 | 3 | Next »
I'm a new line. {{foo}}
I'm a Break line. {{foo}}
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://javatechnologycenter.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function MyCtrl($scope) {<!-- from infovision-->
$scope.foo = "I'm foo!";
$scope.lines = [];
$scope.addLine = function () {
$scope.lines.push($scope.lines.length);
};
$scope.breakLine= $scope.$watch(function(){
$scope.lines.push($scope.lines.length);
})
}
</script>
</head>
<body>
<div ng-app ng-controller="MyCtrl">
<button ng-click="addLine()">Add a line</button>
<div ng-repeat="line in lines">
I'm a new line. {{foo}}
</div>
</div>
<div ng-app ng-controller="MyCtrl">
<button ng-click="breakLine()">Break Line</button>
<div ng-="line in lines">
I'm a Break line. {{foo}}
</div>
</div>
</body>
</html>
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com