I have the following code.
html:
<body ng-controller="MainCtrl">
<div ng-if="isOwner">
<input type="checkbox" ng-model="checkboxClicked"
/>
</div>
<span ng-show="checkboxClicked">Non Editable</span>
<span ng-hide="checkboxClicked">Editable</span>
</body>
js:
app.controller('MainCtrl', function($scope) {
$scope.isOwner="true";
$scope.checkboxClicked="true";
});
- If
Owner
andcheckboxClicked
values aretrue
, thencheckbox
should be always selected by default on execution i.e with Non-Editable. like:
-
It should execute the same above output by default even though if we refresh the browser also (here also if
Owner
andcheckboxClicked
values aretrue
). -
As a Owner, we can
uncheck
thischeckbox
also, so then output should be with theEditable checkbox
i.e, like: Editable.
Please help me in this context to get my desired outputs as per above screenshots and conditions, I have tried with that code, but it is giving with empty checkbox with Non Editable text, as I believe I am failing to write the conditions.
Created Plnkr.
Aucun commentaire:
Enregistrer un commentaire