Michael, I hear you, but it's probably not a good code pattern for a
newbie.  Understanding that you can add more dependencies vs creating a new
config function for each provider is more the point here.  I believed that
to be the issue, but now I see maybe it's not.

On Sat, May 2, 2015 at 2:23 PM, Michał Wasiluk <[email protected]> wrote:

> @Luke Kenede -  Why there should be only one config block per module?
>
> Angular applies configuration blocks in the same order they were
> registered  (
> https://code.angularjs.org/1.3.15/docs/guide/module#configuration-blocks)
> I prefer to split large config blocks for code clarity.
>
> Regards
>
> sob., 2.05.2015 o 20:44 użytkownik Luke Kende <[email protected]>
> napisał:
>
>> There should only be one config().  You can mass multiple dependencies
>> into it... that's what the Array[] syntax is.  Notice the array passed into
>> config() has many string-names to reference each provider needed, then the
>> variable names are passed as arguments into the function.   So anytime you
>> need more dependencies, just add it in both spots.
>>
>> app.config(['$routeProvider','$locationProvider', function($
>> routeProvider, $locationProvider){
>>
>>   $routeProvider.when('/home'{ ... }); //all the route stuff... shortened
>> for example
>>
>>   $locationProvider.html5Mode(true).hashPrefix('!');
>>
>> }]);
>>
>> Now that you've set html5Mode, you shouldn't have to add anchors to your
>> links:
>>
>> <a href="/games">Games</a>
>>
>> On Sat, May 2, 2015 at 12:13 PM, Mariusz Wilk <[email protected]> wrote:
>>
>>> Thx!
>>> So I ended up using the following to get it to work:
>>>
>>> My index.html includes:
>>> <li><a href="/#/games">Games</a></li>
>>>
>>> and my config() function includes:
>>> .when('/games', {
>>>      controller: 'Games',
>>>      templateUrl: 'controllers/games.html'
>>> })
>>>
>>> It works but as you can see I need to use a # in my href since it
>>> simply appears in the url on its own.
>>> I saw a suggestion to add the following:
>>> app.config(['$locationProvider', function($locationProvider){
>>>   $locationProvider.html5Mode(true).hashPrefix('!');
>>> }]);
>>>
>>> I did but as a separate config() function. And it doesn't work. Should I
>>> include this into my main config()?
>>> app.config(function($routeProvider){
>>> $routeProvider
>>> .when('/', {
>>> controller: 'Posts',
>>> templateUrl: 'controllers/posts.html'
>>> })
>>> .when('/games', {
>>>     controller: 'Games',
>>> templateUrl: 'controllers/games.html'
>>> })
>>> });
>>>
>>> If so, how?
>>>
>>>
>>>
>>>  --
>>> 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/VjnEoJw2URI/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.
>>>
>>  --
>> 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/VjnEoJw2URI/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.
>

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