【问题标题】:AngularJS with node-webkitAngularJS 与 node-webkit
【发布时间】:2012-11-08 16:47:27
【问题描述】:

我现在正在评估 node-webkit 作为使用 Web 技术构建桌面应用程序的可能解决方案,并且有一个小问题。该应用程序正在使用 AngularJS,我遇到的问题是似乎没有正确加载我的 html 模板文件。

我的测试应用程序有这个配置:

nucleusApps.config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
  $locationProvider.html5Mode(true);
  $routeProvider
    .when('/style', {
      templateUrl: '/templates/core/style.html',
      controller: nucleusApps.controllers.Style
    })
    .otherwise({redirectTo: '/style'});
}]);

问题是我收到以下错误:

Failed to load resource     file://templates/core/style.html

我为 templateUrl 尝试了多种不同的格式,包括:

./templates/core/style.html
file://template/core/style.html

但我不断收到此错误。我的目录结构也是:

-index.html
-package.json
-css
  -file.css
  -etc...
-templates
  -core
    style.html
-etc...

这就是被拉上拉链的东西。

你知道我为什么会收到这个错误吗?

- 更新-

不确定这里发生了什么,但刚刚更新了我的代码(我正在构建的网络版本),现在一切正常。旧代码中一定有一些奇怪的东西

【问题讨论】:

  • 不确定这里发生了什么,但刚刚更新了我的代码(我正在构建的网络版本),现在一切正常。旧代码中一定有一些奇怪的东西

标签: angularjs node-webkit


【解决方案1】:

我还没有使用过html5mode,但问题就出在这里。 $locationProvider,

【讨论】:

  • 删除修复加载资源失败的问题(以及创建路径./templates/corestyle.html)但是我没有得到一个错误,只是一遍又一遍地重复:10 $digest( ) 迭代次数达到。中止!
  • 没有你的其他代码,我猜你是 1) 调用 scope.$apply 当你不应该或 2) 改变一些 Angular 认为你不应该像一个内部 Angular 构造(类似于 angular.$$foo)。
  • 为什么它可以在 chrome 浏览器中正常工作,但不能在 node-webkit(它使用 chromium)中工作?
  • hmm 好问题,您可能想研究 angularjs googlegroup,我似乎记得部分问题存在 - 特别是 chrome。抱歉,我没有 node-webkit exp。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-06-13
  • 2014-08-31
  • 1970-01-01
  • 2013-04-24
  • 2014-02-15
  • 2015-06-12
  • 2015-11-26
相关资源
最近更新 更多