如下代码,为什么console.log里有两个w?为什么用alert缺不行。
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>angularJS</title>
<script src = "http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app = "first" >
<div ng-controller = "con1">
</div>
<script>
var app = angular.module("first",[]);
app.controller("con1",function($scope,w){
console.log('w',w); //这样的写法是怎么来的?怎么又两个w
// alert(w);
});
app.factory("w",function(){
return {
a:10,
b:5
}
});
app.decorator("w",function($delegate){
$delegate.c = 2;
return $delegate;
});
</script>
</body>
</html>
Javascript的console.log()用法