Hi Pawel, Thanks for your effort. I was looking the exact same thing as you've described and goggled a lot but didn't find any clear solution. Your solution is working great but still thinking it is the right way to do it... Did you find any other way to do it? Please post. :)
On Tuesday, 18 February 2014 05:37:48 UTC+5:30, Pawel Sledzikowski wrote: > > Back to 2012 I was using the solution proposed by @Антон Грибанов and it > was working quite well. Although, there was still a fundamental problem > with it: we always had to create unnecessary container wrapper inside child > template in order to be able to put *ng-controller* into it. In the end, > instead of simple one DIV container we ended with nested two of them. > > I didn't like that fact but I couldn't find any other fix for it. > > Apparently, now (2 years later) I found that we can take advantage of both > *$controller* service and *ng-controller-controller* directive (which > surprisingly is not even documented anywhere as far as I can see). > Combining these two mechanism together we can achieve the desired result. > > Not sure if there is any conceptual problem with that new solution but as > long as external 'angular-route' module is using it internally (I found it > exactly there in a source code of that module) I think we could incorporate > it also to *ng-include* case. > > Updated fiddle: http://jsfiddle.net/F27sP/1/ > > On Thursday, May 9, 2013 12:06:10 PM UTC+2, Mark Chapman wrote: >> >> Hi >> >> I am trying to do something fairly similar - see the plunk at >> http://plnkr.co/edit/ScHvmU?p=preview and I am stuck. Did you resolve >> this elegantly? >> >> Mark >> >> On Monday, 15 October 2012 17:49:41 UTC+1, Eduardo Martinez Cobos wrote: >>> >>> Yes, I'm now using ng-include inside a ng-repeat, to have multiple >>> templates instantiated. >>> Each template has its ng-controller, but I Wanted to take out the >>> controller, defining it out, on the ng-repeat, to make it more decoupled >>> and help me with other issues. >>> I'm triying to make a DialogManager service/directive with each dialog >>> defined as a template and controller. >>> >>> I'll continue trying thinks, thank you both! >>> Edu >>> >>> 2012/10/15 <[email protected]> >>> >>>> You can include different templates based on variable like (for func = >>>> 'rss'): >>>> <div ng-include="templateUrl">Loading...</div> >>>> Set this $scope.templateUrl = 'partials/' + func + '.html' >>>> and in included template (rss.html) do like this: >>>> <div data-ng-controller="RssController"> >>>> >>>> >>>> воскресенье, 14 октября 2012 г., 13:27:34 UTC+4 пользователь Eduardo >>>> Martinez Cobos написал: >>>> >>>>> Hello, >>>>> I can't set ng-controller with scope variables: >>>>> >>>>> http://jsfiddle.net/eemece2/ADukg/1074/ >>>>> >>>>> All my attemps have failed. >>>>> How can I do it? >>>>> >>>>> Thanks! >>>>> Edu >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "AngularJS" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> Visit this group at http://groups.google.com/group/angular?hl=en. >>>> >>>> >>>> >>> >>> -- 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/d/optout.
