Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sharing same function between 3 controllers
Message
From
20/02/2015 11:45:08
 
 
To
19/02/2015 04:00:36
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01615503
Message ID:
01615641
Views:
28
>>>>Looks as if you're using angular-ui. If that's the case wouldn't a nested state/view be a good solution.
>>>
>>>No, the grids are not identical.
>>
>>You could put the loadView function outside the controllers and call it from each passing in $scope, $rootscope and invoiceno. ?
>
>Why not create a common prototype for those 3 controllers?
Possible I guess. But angular used dependency injection for controllers so I don't think it would be any cleaner ?
>
>>>
>>>>P.S. Don't like the $parent.$parent part. If's inheritantly (no pun intended) fragile since it depends on a known/fixed scope hierarchy....
>>>
>>>I don't like it either, but it was not my code, so I left it as is. I did figure out a solution. I declared the function at the top of the file and had to pass $scope, $rootScope and $state to it and then I was just calling this function 3 times (which I don't like either, but can live with it).
Previous
Reply
Map
View

Click here to load this message in the networking platform