javascript - 使用 grunt 任务更改恒定 Angular 内容

标签 javascript angularjs gruntjs

我有一些 Angular 常数,可以根据我的环境设置 Remote :

喜欢

app.constant('fooConst', {
  urlBase: window.location.origin + '/bar/',
  urlBaseWebservice: window.location.origin + '/foo/' + 'bar/rc/'
  // urlBase: 'http://localhost:8080/mvsaudeweb/',
  // urlBaseWebservice: 'http://localhost:8080/foo/' + 'bar/rc/'
});

我要做什么才能使 grunt 任务“dist”自动更改为 window.location.origin?

编辑:

我使用 grunt-replace 解决了这个问题 我不需要 window.location.origin,对我来说替换是空字符串。谢谢

最佳答案

我用过这个https://github.com/werk85/grunt-ng-constant使用不同的配置集构建应用程序。

关于javascript - 使用 grunt 任务更改恒定 Angular 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37127758/

相关文章:

AngularJS 测试 : Jasmine mock callback

git - Grunt-shell 将命令输出保存为变量

javascript - 为什么我的 slider 工具提示在开始时不显示文本?

javascript - 如何在 AngularJS Controller 中调用 javascript 函数?

javascript - 无法使用 mocha 和 supertest 测试 OPTIONS 方法

angularjs - Passport.socketio 和客户端仅在重新启动服务器时连接/重新连接

node.js - Sails js 运行测试

macos - Grunt 在 OSX 上弹起我的终端停靠图标

javascript - 如何隐藏KmlLayer?

javascript - 使用正则表达式验证特定范围