Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></
script>

</head>
<body ng-app="">
<p>enter your firstname : <input type="text" ng-model="firstname"></p>
<p>enter your lastname : <input type="text" ng-model="lastname"></p>
<P>{{firstname}}</P>
<P>{{lastname}}</P>
</body>
</html>
-------------------1st-----------------------------------------------------
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></
script>
</head>
<script>
var app = angular.module("myapp",[]);
app.controller("myctrl",function($scope){
$scope.names=[];
$scope.Add = function (){
$scope.names.push($scope.add);
}
$scope.Remove=function(x){
$scope.names.splice(x,1);
}
})
</script>
<body ng-controller="myctrl">
<ul>
<li ng-repeat="x in names">
{{x}}
<input type="button" ng-click="Remove($index)" value="Remove">
</li>
<input type="text" ng-model="add">
<input type="button" ng-click="Add()" value="Add">
</ul>

</body>
</html>
---------------------------------------------------------
2nd program

You might also like