gulp-ng-annoate错误,由于解析错误而无法处理源 [英] error with gulp-ng-annoate, couldn't process source due to parse error
问题描述
我正在解决由gulp-ng-annoate生成的错误.
I am getting trouble with error that is generated with gulp-ng-annoate.
错误消息是
错误:app.js:错误:由于解析错误而无法处理源代码
Error: app.js: error: couldn't process source due to parse error
我发现另一个线程似乎对我有同样的问题,但该答案对我不起作用.另一个线程
I've found the other thread which seems to have same problem with me but that answer does not work for me. the other thread
这是我的gulp文件和我正在尝试执行任务的文件.
Here is my gulp file and the files that I am trying to execute the tasks.
gulpfile.js
gulpfile.js
var gulp = require('gulp')
var concat = require('gulp-concat')
//var uglify = require('gulp-uglify')
var ngAnnotate = require('gulp-ng-annotate')
gulp.task('js', function(){
gulp.src(['ng/module.js', 'ng/**/*.js'])
.pipe(concat('app.js'))
.pipe(ngAnnotate())
//.pipe(uglify())
.pipe(gulp.dest('assets'))
})
和我要合并的文件/ngAnnotate
and files that I am trying to concat/ngAnnotate
angular.module('app', [])
posts.ctrl.js
angular.module('app')
.controller('PostCtrl', function($scope, PostsSvc){
$scope.addPost = function(){
if ($scope.postBody){
PostsSvc.create({
username: 'dickeyxxx',
body: $scope.postBody
}).success(function(post){
$scope.posts.unshift(post)
$scope.postBody = null
})
}
}
PostsSvc.fetch().success(function(posts){
$scope.posts = posts
})
})
posts.svc.js
angular.module('app')
.service('PostsSvc', ['$http', function ($http){
this.fetch = function(){
return $http.get('/api/posts')
}
this.create = function(post){
return $http.post('/api/posts', post)
}
}])
可能出了什么问题..?
What could have gone wrong..?
推荐答案
错误的是,您放置了.
而不是,
来分隔对象.
What is wrong is that you put a .
instead a ,
to separate object.
此外,请不要忘记;
结束行.
Also, don't forget the ;
to end your line.
这篇关于gulp-ng-annoate错误,由于解析错误而无法处理源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!