angular - In an angular2 component how do you get both the attribute text value as well as the bound variable? -


is there way both plain text value of attribute getting attribute input component? e.g. have @input('c-failure') cfailure; gives me this.cfailure bound outer variable. component created in outer template <c-component c-failure="failures.secondary['cause']">. variable value "failures.secondary['cause']" variable bound value of outer this.failures.secondary.cause. tried injecting elementref, doesn't seem have or attributes bound @input.

i try following leveraging @input , @attribute decorators. seems it's not possible mix them on same attribute

@component({   selector: 'test' }) export class somecomponent {   @input('c-failure')   cfailure;    constructor(@attribute('c-failure-expr') cfailureexpr:string) {   } } 

and use way:

<test [c-failure]="failures.secondary['cause']"       c-failure-expr="failures.secondary['cause']"></test> 

see plunrk: https://plnkr.co/edit/yaoamjzjkntajwpdhsx8?p=preview.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -