R
R
Roman Rodionov2016-09-05 22:44:34
JavaScript
Roman Rodionov, 2016-09-05 22:44:34

How and when is it better to load .js and .css files in an angular SPA application?

I have my own css and js file for each view, respectively, how and when to load it?
Here is the routing, but along with the template, you also need to load css and js files.

(function(){
    angular.module("app", ["ngRoute"])
        .config(function($routeProvider){
            $routeProvider.when("/registration", {
                templateUrl: "/templates/registration/form.html",
                controller: "registrationCtrl"
            });
            $routeProvider.otherwise({redirectTo: '/registration'});
        });
})();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-09-06
@Romashishka

Put everything in one file. There are very few cases where such a division is appropriate. I'm 99% sure yours isn't one of them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question