Why not use ng-switch? http://docs.angularjs.org/api/ng.directive:ngSwitch
On Thu, Feb 6, 2014 at 11:54 AM, AngularNutCase <[email protected] > wrote: > OK so this seems fine, and you've definitely answered my question. > > Now I'd like to be cheeky and ask about my next step ! .. this is to for > "mycontrol" to display a different HTML element depending on the type of > the column. > > soo switch (mycolumn[currentcolumn].type) > case "input": > mytemplate = "<input" ... > > case "textarea" > mytemplate = "<textarea" ... > > etc > > So starting here: http://jsfiddle.net/paull3876/zUvUz/ > > (a) can we set the template programmatically ? If yes we'd need access to > the mycolumn[column].type > (b) do we go back to link: and do it in there > or > (c) I think I also saw a compile: function inside the directive function - > perhaps it should go in there ?? > > thanks again for your help > > > On Thursday, February 6, 2014 4:10:11 PM UTC, Chris Rhoden wrote: > >> http://jsfiddle.net/UYbL9/ >> >> This really lays bare that this directive is just a wrapper for input >> ng-model. You should consider the ng-namespace reserved and not for your >> use, so I have changed it to my-model. If you're going to add additional >> behavior to the directive then this makes sense, but otherwise <input >> ng-model /> would require less indirection. >> >> >> On Thu, Feb 6, 2014 at 11:05 AM, AngularNutCase <[email protected] >> > wrote: >> >>> Thanks Chris. Your post came in while I was answering Sander. I will now >>> try to lose the "link" function and see if I can do it using template: >>> instead, as you have suggested. >>> >>> I think the difficulty is that we have "record" and "colname" variables, >>> and I don't really understand how it all hangs together. I'm new to this >>> and just learning Angular >>> >>> >>> >>> >>> On Thursday, February 6, 2014 3:56:43 PM UTC, Chris Rhoden wrote: >>> >>>> I am having a hard time understanding what you're looking to do. >>>> chrisrhoden >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "AngularJS" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> >>> Visit this group at http://groups.google.com/group/angular. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> chrisrhoden >> > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- chrisrhoden -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
