i trying remove elements of same class leave first one. how can achieve in angular?
var myelement = angular.element( document.queryselector( 'myclass') ); myelement.not(':first').remove() //removes element
this error getting: ionic.bundle.js:21157 typeerror: myelement.not not function
the .not()
function isn't defined in jqlite, angular.element
, acording docs, doesn't implements jquery selectors , methods.
update 1
here example.
var myelements = document.getelementsbyclassname( 'myclass'); myelements = array.prototype.slice.call( myelements ); // convert htmlcollection array myelements = myelements.splice(0, 1); //removes first working list angular.element(myelements).remove(); //removes remaining elements dom
Comments
Post a Comment