为什么 system.js returns 是一个空对象而不是 angularjs?
Why system.js returns an empty object instead of angularjs?
为什么 system.js returns 是空对象而不是 angularjs?如何解决?
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
}
});
System.import('angular').then(function(data){
console.log('###', data);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
因为 AngularJS 正在全局加载,not as a module.
执行导入后,angular
在全局范围内可用。
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
}
});
System.import('angular').then(function(){
console.log(angular);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
},
meta: {
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js': {
'format': 'global'
}
}
});
System.import('angular').then(function(data){
console.log('###', data);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
为什么 system.js returns 是空对象而不是 angularjs?如何解决?
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
}
});
System.import('angular').then(function(data){
console.log('###', data);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
因为 AngularJS 正在全局加载,not as a module.
执行导入后,angular
在全局范围内可用。
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
}
});
System.import('angular').then(function(){
console.log(angular);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
System.config({
map: {
angular: 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js'
},
meta: {
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.js': {
'format': 'global'
}
}
});
System.import('angular').then(function(data){
console.log('###', data);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>