This article is for you.
http://ify.io/lazy-loading-in-angularjs/

2014年2月26日水曜日、Ingólfur Valsson<[email protected]>さんは書きました:

> As the development environment might be different from the production
> environment I have found it to be troublesome to hardcode url instead of
> using variables. This is especially true when virtual directories are
> involved.
>
> I for example have a Angular app backed by WebApi. It might all work fine
> until I host it under a virtual directory, then I do not find the
> partial.html and api urls because I ignore them.
>
> I had this idea I would create a service in the initialization of the
> index file where the app is bootstrapped.
>
>     <script type="text/javascript">
>>         angular.module('MyApp').factory('urlService', function () {
>>             var urlService = {
>>                 partialsUrl: '@Url.Content("~/Content/Partials/")',
>>                     Url: '@Url.RouteUrl("Default")'
>>                 }
>>                 return urlService;
>>             });
>>     </script>
>
>
> and then inject this where needed but it isn't working. I get
>
> Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp
>> due to: Error: [$injector:unpr] Unknown provider: urlService
>>
>
> Might be some timing issue, I added this script after both the angular.js
> and app.js
>
> How do you guys normally do something like this?
>
> --
> 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]<javascript:_e(%7B%7D,'cvml','angular%[email protected]');>
> .
> To post to this group, send email to 
> [email protected]<javascript:_e(%7B%7D,'cvml','[email protected]');>
> .
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to