【问题标题】:Is there a directory file that dictates the structure in the angular-seed example?是否有一个目录文件指示 angular-seed 示例中的结构?
【发布时间】:2014-01-16 17:38:21
【问题描述】:

我是 Angular JS 的新手,并且一直在使用 angular-seed,这是一个干净的 Angular JS 应用程序示例,但注意到 ref 路径不遵循文件结构。

例子是下面的配置路由,文件结构如下:

config(['$routeProvider', function($routeProvider) {

  $routeProvider.when('/view1', {
    templateUrl: 'partials/partial1.html', 
    controller: 'MyCtrl1'
  });

}]);

种子应用目录的文件结构

/app
--/css
--/img
--/js
---app.js (file that contains the above code snippet
--/lib
--/partials
--index.html

templateURL 路径不应该是“../partials/partial1.html”吗?是否有某个文件覆盖了它?

【问题讨论】:

    标签: angularjs


    【解决方案1】:

    没有。 templateUrl 请求将由服务器处理。它可能被映射到不同的路线。例如,静态文件可能在部分下,但请求可能必须类似于 http://example.com/public/partials/partial1.html

    因此它不必与项目结构相关。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-07
      • 1970-01-01
      • 2014-03-23
      • 1970-01-01
      • 1970-01-01
      • 2013-11-11
      • 2020-06-17
      • 2014-06-21
      相关资源
      最近更新 更多