求助Java程序设计实验指导程序代码答案
1个回答
2015-08-18
展开全部
Migrating your code to ES6 is easier than you think.
var babel = require('gulp-babel');
gulp.task('build', function() {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
Use the Angular 1.4 Router
Mix Angular 1 and Angular 2 components. Mix ES5 and ES6.
ES5 Angular 1 Service
angular.module('hype', ['unicorn'])
.service('unicornHype', ['unicornHorn', '$q',
function(unicornHorn, $q) {
this.horn = unicornHorn;
this.findUnicorn = function() {
var deferred = $q.defer();
navigator.geolocation.getCurrentPosition(function(pos) {
this.horn.thrust();
deferred.resolve('The unicorn is at ' + pos.coords.latitude);
}.bind(this), deferred.reject);
return deferred.promise;
};
}
]);
var babel = require('gulp-babel');
gulp.task('build', function() {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
Use the Angular 1.4 Router
Mix Angular 1 and Angular 2 components. Mix ES5 and ES6.
ES5 Angular 1 Service
angular.module('hype', ['unicorn'])
.service('unicornHype', ['unicornHorn', '$q',
function(unicornHorn, $q) {
this.horn = unicornHorn;
this.findUnicorn = function() {
var deferred = $q.defer();
navigator.geolocation.getCurrentPosition(function(pos) {
this.horn.thrust();
deferred.resolve('The unicorn is at ' + pos.coords.latitude);
}.bind(this), deferred.reject);
return deferred.promise;
};
}
]);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询