Angularjs - Html DOM in Hindi




AngularJS में HTML DOM तत्वों के गुणों के लिए बाध्यकारी application डेटा के निर्देश हैं डोम document ऑब्जेक्ट मॉडल के लिए स्थिर है angularJS directives को HTML DOM elements की विशेषताओं के लिए आवेदन डेटा को बाइंड करने के लिए उपयोग में लाया जाता है.

AngularJS में, सभी निर्देशों का उपयोग HTML डोम तत्वों के गुणों में आवेदन डेटा को बाँधने के लिए किया जाता है Angularjs में 4 प्रकार के directive का उपयोग application डेटा को बाँधने के लिए किया जाता है -

  • ng-disabled directive

  • ng-show directive

  • ng-click directive

  • ng-hide directive

ng-disabled directive

यह directive angularJS application डेटा को एचटीएमएल elements के disabled विशेषता में बांधने के लिए यूज़ होती है.

ng-show directive

इस directive का उपयोग angularJS में एक HTML तत्व को दिखाने या छुपाने में किया जाता है.

ng-click directive

यह directive एक angularJS क्लिक ईवेंट का प्रतिनिधित्व करता है और कुल क्लिक को HTML तत्व मानता है.

ng-hide directive

यह directive एक HTML तत्व को छुपाता है या फिर दिखाता है.

Example Code

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="" ng-init="mySwitch=true">
<p>
<button ng-disabled="mySwitch">Click Me!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>Button
</p>
<p>
{{ mySwitch }}
</p>
</div> 

</body>
</html>

Example Result

Button

{{ mySwitch }}