Angularjs Examples

AJS Examples

AngularJS ng-ReadOnly Directive

The AngularJS ng-readonly directive is used to make DOM elements readonly.It traverses all DOM elemets with the readonly property and makes the element readonly.


<input type="text" ng-readonly="checked"/>

AngularJS ng-ReadOnly Directive Example

<title>My first AngularJS ng-readonly Directive code</title>
<Script SRC="">
function appController($scope) {
    $scope.firstName = "Jimi";
    $scope.lastName = "Scotts";
    $scope.truefalse = "false";
<div ng-app ng-controller="appController">
    <p>First Name:
        <input ng-model="firstName" ng-readonly="true"/>
    <p>Last Name:
        <input ng-model="lastName" ng-readonly="{{truefalse}}"/>

See Live Example