国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - About angular RouteProvider
ringa_lee
ringa_lee 2017-05-15 17:03:03
0
3
623
config(['$routeProvider', function($routeProvider){
    $routeProvider.when
} ]);

config(function($routeProvider){
    $routeProvider.when
});



請(qǐng)問(wèn)這兩種方式配置路由有什么區(qū)別?

ringa_lee
ringa_lee

ringa_lee

reply all(3)
劉奇

http://www.html-js.com/article/2956

大家講道理

Read the documentation first

Pay attention to the red part. If you inject dependencies without explicitly specifying parameters, those variable names may be replaced when you minifycode, causing the runtime injection to fail

洪濤

Both of these are dependency injection methods. There are three injection methods in
ng:
a, inferential injection
app.controller('MyCtrl', function($scope) {
});

b, annotated injection
var myFunc=function($scope) {
});
myFunc.$inject = ['$scope'];
app.controller('MyCtrl',myFunc);

c, inline injection
app.controller('MyCtrl', ['$scope', function($scope) {
}]);

The first method is based on the written parameter name, such as $scope, and calls $inject internally to inject $scope into the dependency. If a compression tool is used in front-end development, $scope will be changed into another letter, and it will not be possible. Inference has been made, and for the other two methods, you can change function($scope) to function(a). It doesn’t matter;
The second method requires writing one more line of code;
It is generally recommended to use the third method.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template