Monday, 7 January 2019

AngularJS ng-bind directive

AngularJS ng-bind directive

ng-bind directive use to bind the innerHTML of the element to the model property. if any changes happen , it will reflect the changes in innerHTML of the element.
it can be used as attribute or as css class

Syntax ng-bind as CSS class
<element class="ng-bind: expression"></element>

Syntax ng-bind as attribute
<element ng-bind="expression"></element>

Example: As CSS class
<div ng-app="myApp" ng-controller="EmployeeController">
    <p>Example: As CSS class</p>
    <br />
    Name: <input type="text" ng-model="Name" />
    <p class="ng-bind:Name"></p>

    var myapp = angular.module('myApp', []);
    myapp.controller('EmployeeController', function ($scope) {
        $scope.Name = "";


No comments:

Post a Comment

Note: only a member of this blog may post a comment.