angularjs - Few questions regarding Angular directives -


i have few questions regarding angular directives

i'm basing questions based on following block of codes

<ul class='parent'>     <li class='child1'></li>     <li class='child2 active'></li>     <li class='child3'></li> </ul> 

so based on above

  • how can create directive based on above (assuming comes angular plugin, , there no angular directive attribute defined within tag)?
  • assuming above angular plugin, , don't intend edit plugin, how can use directive see list active?
  • how can operations through code above using angular? jquery, can as

for checking child length

$('.parent').children().length 

for iterating through child elements

$.each($('.parent').children(), function(){ console.log(this); }); 

but when tried angular way

angular.element(document.queryselectorall('.parents')).children().length 

somehow part returned me wrong value. guess jquery mindset reason why couldn't value still, read somewhere angular.element object equivalent of jquery $() object, both should able use same functions.

  • if want event binding on code above should inside link function correct? if want watch , apply changes code above, should use directive's scope , inside link function right?
  • is there easy-to-chew guide on how angular's directives? somehow of read pretty confusing directive guide in angularjs documentation itself.


Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -