我使用browserify作为我的角度客户端应用程序.我需要使用下划线.使用bower安装angular,使用npm安装下划线
这就是我运行browserify(npm)并在gulp(npm)中创建源映射的方法
gulp.task('browserify', function() {
return browserify(dir.script_from + '/main.js', {debug: true})
.bundle()
.pipe(source('bundle.js')) // gives streaming vinyl file object
.pipe(buffer()) // <----- convert from streaming to buffered vinyl file object
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify()) // now gulp-uglify works
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(dir.script_to));
});
Run Code Online (Sandbox Code Playgroud)
在我的main.js中,我有
//require('underscore')
require('angular')
require('angular-resource')
require('angular-route')
require('./home/home_page.js')
...
Run Code Online (Sandbox Code Playgroud)
如果我不需要('下划线'),源地图就可以了.我可以查看原始文件并设置断点.

但如果我需要('下划线'),源地图就不再起作用了.我甚至无法查看文件.

我也尝试用bower安装下划线,但是我收到以下错误:
[23:59:02] Starting 'browserify'...
events.js:85
throw er; // Unhandled 'error' event
^
Error: Cannot find module 'underscore' from '/Users/[my path]/app/client/script'
Run Code Online (Sandbox Code Playgroud)
请注意,这两个bower(我配置了路径)和npm将模块放在'/ Users/[my path]/node_modules'文件夹中
我甚至尝试了只有一行的main.js:require('underscore')并且没有工作,但是空的main.js文件有效
我想让我的游戏加载图片的时间更长(Default.png),怎么样?
我有一个由多个任务资源组成的项目资源(类似于 Facebook 帖子和评论关系)
当我更新项目时,我想使用 url /project/[project id]。当我更新任务时,我想使用 url/project/[project id]/[task id]
这是我的项目资源服务:
angular.module('project').factory('Project', ['$resource', function($resource) {
return $resource('project/:projectId', {
projectId: '@_id'
}, {
update: {
method: 'PUT'
}
})
}])
Run Code Online (Sandbox Code Playgroud)
现在我想定义任务资源:
angular.module('task').factory('Task', ['$resource', function($resource) {
return $resource('project/:projectId/:taskId', {
projectId: '' //how can i pass in the project Id from controller?
taskId: '@_id'
}, {
update: {
method: 'PUT'
}
})
}])
Run Code Online (Sandbox Code Playgroud)
在我的控制器中,如果我只是更新项目,而不是它的任务,那么我只需使用:
$scope.update = function() {
$scope.project.$update(function() {
$location.path('project/' + $scope.project._id)
}, function(errResponse) {
$scope.error = errorResponse.data.message
})
} …Run Code Online (Sandbox Code Playgroud) 我想制作水果忍者刀片.我正在使用cocos2d,而MotionStreak对此非常难看.MotionStreak的任何其他方法或更好的设置?可能是粒子系统?任何类似于ParticleDesigner的免费伟大工具?
angularjs ×2
iphone ×2
objective-c ×2
browserify ×1
ios ×1
ngresource ×1
node.js ×1
particles ×1