Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any ways to improve directive without complete re-write?
Message
 
 
General information
Forum:
AngularJS
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01652591
Message ID:
01652625
Views:
37
>>>Bit rusty on directives so may be missing something but I don't see what your problem is. Can you explain a bit more.
>>>Also don't know why transclude is true since there's no ng-transclude directive in the template ?
>>
>>Right now this directive is a button (single input control). In run-time it's value becomes either 'Select Layout' or name of the selected layout.
>>
>>I want to add to it a button to clear that selected layout and also there needs to be some sort of the control to launch the form to edit that selected layout (may be right click - not sure).
>>
>>But I don't see a way of adding that extra control of clearing the layout as the template is currently a single button those value (text) is replaced in run-time.
>>
>>Do you see my problem?
>
>Sorry, no. Why can't you add another button to the template?

Because this is the code used in my forms
<data-desc:type title="{{ '@String.Format(Labels.selectX, Labels.layout)'}}" do-search="popup()"
                                            value="{{currentItem['t'+n+'LayoutId'] == 0 ? '@String.Format(Labels.selectX, Labels.layout)' : currentItem['t' + n + 'Layout']}}"
                                            param="layouts" message="@String.Format(Labels.selectX, Labels.layout)"
                                            filter-by="Ticket"
                                            selected="currentItem['t'+n+'LayoutId']" descrip-value="descrip" type-value="lTypeId"
                                            description="currentItem['t'+n+'Layout']">
                            </data-desc:type>
As you can see, the above has value property. In run-time this becomes a single button with either Select Layout or name of the currently selected layout.

I can, if necessary, adjust all my HTMLs.

I guess I can also remove the replace and transclude (set them to false) and use 'value' as a new property of the directive, then I would be able to set value of the button in the template directive to the value used in my HTML. Sounds like this may work, I'm going to try it today.

Thanks, Viv, conversing with you helps to see a simple solution - I may not even need to change any of my HTMLs.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform