javascript - Accessing scope params of children directives -


i'm new in angularjs, using 2 months in project. i've learned how use directives , theirs scopes (false, true, obj literal), there's questions it...

first of all, have ng-repeats , directives behaviors, tried present equivalent scenario in this link.

  1. i didn't figure out how access function (testfn - within ng-controller) inside directive child of directive myitemdirective. in mystepdirective it's accessible, tried pass in first "layer" didn't work.

    ps.1: created mystepdirective isolated scope other examples, if need, uncomment test. both got way access params/functions parent (controller), not inside grandchild.

  2. why directive's scope params doesn't work camel case params? don't remember read hint in angularjs docs... typewithnocase inside myitemdirective works typelist not.

thanks!

edited] 1. here working fiddle working limited scope , camel snake case conversion : https://jsfiddle.net/wu0avqau/ spend loooooong time not understanding why didn't worked juste forgot = in ng click inside second directive

ng-click"testfn()" 

for 2. can refer documentation : https://docs.angularjs.org/guide/directive

normalization

angular normalizes element's tag , attribute name determine >elements match directives. typically refer directives case->sensitive camelcase normalized name (e.g. ngmodel). however, since html case->insensitive, refer directives in dom lower-case forms, typically >using dash-delimited attributes on dom elements (e.g. ng-model).

the normalization process follows:

strip x- , data- front of element/attributes.
convert :, -, or _-delimited name camelcase."

basicaly myitemdirective my-item-directive inside template still myitemdirective inside js.

good luck,
thibaud lamarche


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -