Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

kendo ui - Forwarding attributes from parent directive to child element in AngularJS 1.4.x

Hi SO my experience with angularJS is fairly lackluster, I've tried reading the documentation and searched around without a lot of results. I am tasked with maintaining a legacy angularJS app that utilizes angularJS 1.4.x, grunt and typescript.

I have a directive for populating and handling a Yes-No select list, this select list is marked with the attribute kendo-drop-down-list I have a need to forward attributes from this directive to the select element due to the way validation works in this project.

This is my usage of the Yes-No dropdown

<yes-no-drop-down ..scopedattributes... 
    data-validationRule1-msg="This is rule 1 that failed"
    data-validationRule2-msg="This is rule 2 that failed"
/>

Inside the yes-no-drop-down directive the scope specify the scopedattributes

scope: IYesNoDropDownControllerScope = {
        selectedoption: "=",
        disabled: "=?",
        name: "@",
    }

The template for the dropdown is the following

<select kendo-drop-down-list
        ... k-xx attributes for kendo ...
        name="{{vm.name}}"   
        >
</select>

My issue is that the attribute data-validationRuleXYZ-msg is variable depending on the validation rule(s) that runs. and I need to forward theese attributes to the select. so I end up with this result

<select kendo-drop-down-list
        name="TestYesNoDropdown"   
    data-validationRule1-msg="This is rule 1 that failed"
    data-validationRule2-msg="This is rule 2 that failed"
        >
</select>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...