Sunday, 22 November 2015

ng-readonly

What is ng-readonly:ng-readonly is used to make element (input ,select ,textarea) read only...
Description of ng-readonly:ng-readonly has priority 100. When given condition in ng-readonly is true ,targeted element become read only.Otherwise when condition is false targeted element has no effect...
Syntax of ng-readonly:

<element ng-readonly="expression">

</element>
or


<input ng-readonly="expression" />
How to Use ng-readonly/ng-readonly Example::
 Example 1:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr" ng-init="flag=true">
        <div>
            Angularjs Example of ng-readonly
            <input type="text" ng-readonly="flag" />

        </div>
    </div>
</div>

Example 2:
<div ng-app="webapp">
    <div ng-controller="angularjsexampleCtlr">
        <div>
            Angularjs Example of ng-readonly
            <input type="text" ng-readonly="flag" />
            <input type="button" ng-click="myfun()" />
        </div>
    </div>
</div>

<script>
    angular.module('webapp', []).controller('angularjsexampleCtlr', function ($scope, $http) {
        $scope.myfun = function () {
            if ($scope.flag == false || $scope.flag == undefined)
                $scope.flag = true;
            else
                $scope.flag = false;
        }
});
</script>

3 comments :


  1. this is just great web kolkata ff cant explain my feleinngs to u thanks

    ReplyDelete
  2. out class content kolkata ff thanks for sharing

    ReplyDelete
  3. Nice Post Your content is very inspiring and appriciating I really like it please visit my site for
    kolkata fatafat and kolkata live result or for finding old result check kolkata ff old result and you can also checkout your lucky number on kolkata ff lucky number you can also visit our site for some tips and tricks kolkata ff tips & tricks
    kolkata fatafat for super fast kolkata ff result
    quote status for some amazing shayari

    ReplyDelete