ADDING CONTROLS DYNAMICALLY IN ANGULARJS

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 738  View(s)
Ratings:
Rate this:
we want to Adding Controls Dynamically  in AngularJS.how to use this please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: Adding Controls Dynamically in AngularJS

    @{

    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!