You also have to do leadLkp.controller('LeadCtrl', LeadCtrl) or something
similar where you introduce the controller itself to the dependency
injection system.

E

On Mon, Dec 1, 2014, 3:25 AM Marco Schmit <[email protected]> wrote:

> Thanks for your answer.
> sounds good.
>
> I gave it a try but its running into some error.
> Heres what i changed:
>
> LeadLpk Module:
>
> var leadLkp = angular.module('LeadLookup', []);
>
> leadLkp.config(['$routeProvider', function($routeProvider) {
>     $routeProvider.
>         when('/lead',
>     {controller: 'LeadLkpCtrl',
>         templateUrl: 'apex/f42_Lead_Lookup'}
>         )
> }]);
>
>
>
> Main Module:
>
> var app = angular.module('f42_Contacting_App', [LeadLookup', 'ngRoute']);
>
> app.config(['$routeProvider', function($routeProvider) {
>     $routeProvider.
>         when('/main',
>          {controller: 'MainCtrl',
>          templateUrl: 'apex/f42_Contacting_Main'}
>         ).
>         /*when('/lead',
>          {controller: 'LeadLkpCtrl',
>          templateUrl: 'apex/f42_Lead_Lookup'}
>         ).*/
>         otherwise(
>          {redirectTo: '/main'}
>         );
> }]);
>
>
> Am I missing something?
>
> Thanks!
>
> 2014-11-30 16:32 GMT+01:00 Eric Eslinger <[email protected]>:
>
>> Personally, I would suggest putting the definition of the /lead route in
>> the LeadLookup module. If you're going to modularize, don't do it by half
>> steps. This is what I do, so that way you can put the /module routes,
>> tests, controllers and so forth all in the same directory and all you have
>> to do is (a) include them in the compiled javascript and (b) declare
>> LeadLookup as a dependency on your top-level app.
>>
>> e
>>
>> On Sun Nov 30 2014 at 1:51:15 AM <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I'm new to angular and I'm trying to modularlize my app.
>>>
>>> My main module gets some other module and I want to use the controller
>>> of the injected module in my route definition.
>>> Some simple example would be very helpful!
>>>
>>> var app = angular.module('Contacting_App', ['LeadLookup']);
>>>
>>> app.config(['$routeProvider', function($routeProvider) {
>>>     $routeProvider.
>>>         when('/main',
>>>          {controller: 'MainCtrl',
>>>          templateUrl: 'apex/f42_Contacting_Main'}
>>>         ).
>>>         when('/lead',
>>>          {module: 'LeadLookup',
>>>          controller: 'LeadLkpCtrl',
>>>          templateUrl: 'apex/f42_Lead_Lookup'}
>>>         ).
>>>         otherwise(
>>>          {redirectTo: '/main'}
>>>         );
>>> }]);
>>>
>>>
>>> --
>>> 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.
>>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/brFTHDPalnU/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>>
>
>
>
> --
> *Marco Schmit* |
> email: [email protected] | fon: +49 89 878067657 | fax: +49 89
> 8780676 99
>
> factory42 GmbH | Rosenheimer Strasse 145 b | 81671 München | Germany
> Geschäftsführer: Michael Frohn | Unternehmenssitz: München | Amtsgericht
> München | HRB 198418
> [image: factory42]München | Berlin | Frankfurt | Düsseldorf
> www.factory42.com
>
> [image: Innovationspreis IT - Best of 2013 - Branchenpreis]
> <http://www.factory42.com/>    [image: Salesforce Certified Administrator]
>      [image: Salesforce Certified Developer]
>
> --
> 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.
>

-- 
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.

Reply via email to