Home > DeveloperSection > Forums > Adding Controls Dynamically in AngularJS
Ankit Singh

Total Post:341

Points:2389
Posted on    February-29-2016 10:00 PM

 Angular JS Angular JS 
Ratings:


 1 Reply(s)
 314  View(s)
Rate this:
we want to Adding Controls Dynamically  in AngularJS.how to use this please help me.


aditya kumar Patel

Total Post:244

Points:1736
Posted on    February-29-2016 10:08 PM

@{

Layout = null;

}

<!DOCTYPE html>

<html>

<head>

<title>Forum</title>

<meta name="viewport" content="width=device-width" />

<script src="~/Scripts/jquery-1.9.1.js"></script>

<script src="~/Scripts/angular.js"></script>

<script type="text/javascript">

var ng = angular.module('myapp', []);

ng.controller('controller', function ($scope) {

$scope.rows = [];

$scope.rows.push({

FirstName: "Fist Name",

LastName: "Last Name",

IsActive: true

});

$scope.addRow = function () {

$scope.rows.push({

FirstName: "Fist Name",

LastName: "Last Name",

IsActive: true

});

};

});

</script>

</head>

<body ng-app="myapp">

<div ng-controller="controller" style="border:5px solid #E4E2E2;width:500px;">

<button ng-click="addRow()" style="color:red;font-size:18px;">Add New Row </button>

<div ng-repeat="row in rows">

<input type="text" placeholder="{{row.FirstName}}">

<input ng-class="{'blockInput': !row.IsActive}" placeholder="{{row.LastName}}" type="text">

<input type="checkbox" name="check" value="inline">IsActive

</div>

<br/>

</div>

</body>

</html>


Don't want to miss updates? Please click the below button!

Follow MindStick