--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/2BemXDo-KvgJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
This is no longer true (since version 1.0rc1), see changelog:
https://github.com/angular/angular.js/blob/master/CHANGELOG.md#1.0.0rc1
Regards,
Witold Szczerba
--
Witold Szczerba
On 30 March 2012 16:29, Raj <rvaur...@gmail.com> wrote:
> Witold,
> So if you do need direct controller inheritance, how would you do
> this?
This has nothing to do with AngularJS, it is the JavaScript stuff.
There is very helpful presentation, by anyone else but Misko himself,
about JavaScript the language:
http://misko.hevery.com/2010/07/14/how-javascript-works/
It is one hour long. If you are going to write JavaScript code for
longer than few days in your life, then I would strongly recommend it.
> Also, is DOM based inheritance achieved purely by nesting one
> controller inside another in the HTML template?
Again, since AngularJS 1.0rc1, controller inheritance has nothing to
do with DOM. You can inherit one controller from another by yourself
if you wish, but the DOM hierarchy does influence nothing but $scope
objects, which may be injected into controllers.
Directives like ngController, or more generally, the template compiler
instantiates controllers and injects all the things they explicitly
want. The injection context also contains $scope and that scope
instance inherits from other $scope object, upper in hierarchy, up to
the $rootScope which is the uber-mother of all scopes.
So, the bottom line is:
var yourController = new YourController(injectables_goes_here);
Whether "yourController.doSomething()" method exist in that
controller, or in some (pseudo) super class (JavaScript does not have
classes, right?) - it is up to you.
I hope this helped :)
Regards,
Witold Szczerba
> Regards,
> Raj
>
> On Mar 30, 7:22 am, Witold Szczerba <pljosh.m...@gmail.com> wrote:
>> OK, to make it clear, as I can see now - you are using most recent
>> version in your example.
>> Scope objects ($scope instances) inheritance is based on the DOM,
>> controllers are not. It is up to you to inherit one controller from
>> another and it has nothing to do with DOM any more.
>>
>> --
>> Witold Szczerba
>>
>> On 30 March 2012 14:18, Witold Szczerba <pljosh.m...@gmail.com> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > On 30 March 2012 09:09, John Lindquist <johnlindqu...@gmail.com> wrote:
>> >> Hopefully this helps:
>> >>http://jsfiddle.net/johnlindquist/UZrVS/29/
>>
>> >> From what I understand, Controller inheritance is based on the DOM
>> >> hierarchy.
>>
>> > This is no longer true (since version 1.0rc1), see changelog:
>> >https://github.com/angular/angular.js/blob/master/CHANGELOG.md#1.0.0rc1
>>
>> > Regards,
>> > Witold Szczerba
>
> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/LTaBnLNCWMEJ.
Pete
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.
Thanks, I'm not sure I like the idea of using a service this way either. All I want to be able to do is re-use some common code across controllers, and also be able to invoke this common code directly from the html.How would you achieve this?
Regards,
Witold Szczerba
>>> angular+u...@googlegroups.com.
>>> For more options, 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 view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/vLg1-UrMNHMJ.
>
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
>>> For more options, 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 view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/vLg1-UrMNHMJ.
>
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/btEyiX4-O1kJ.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
>>> angular+u...@googlegroups.com.
>>> For more options, 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 view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/vLg1-UrMNHMJ.
>
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, 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.