AngularJS Set Get and Remove Attribute Dynamically Form Element
In this Post We Will Explain About is AngularJS Set Get and Remove Attribute Dynamically Form Element With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Set Attribute or Remove Attribute using AngularJSExample
In this post we will show you Best way to implement AngularJS remove HTML attributes Example, hear for angularjs – conditionally add an element attributewith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
Angularjs read attribute value of an HTML elemnt
[php]
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
alert(myparm.attr(‘tempattrval’));
[/php]
Angularjs set attribute value of an HTML element
[php]
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
myparm.attr(‘tempattrval’,”attr val”);
[/php]
Angularjs remove attribute of an HTML element
[php]
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
myparm.dltAttribute(‘tempattrval’);
[/php]
Angularjs Set Attribute or Remove Attribute using AngularJS
[php]
function liveCtrl($scope) {
$scope.readAttrval = function() {
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
alert(myparm.attr(‘tempattrval’));
}
$scope.setAttr = function() {
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
myparm.attr(‘tempattrval’,”attr val”);
alert(“HTML attribute set”);
}
$scope.dltAttribute = function() {
var myparm = angular.element( document.querySelector( ‘#live_divid’ ) );
myparm.dltAttribute(‘tempattrval’);
alert(“HTML attribute removed”);
}
}
[/php]
I hope you have Got What is angularjs – conditionally add an element attribute And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.