0

In an angular app, I have a module that I want to use within another.

module A defines listController and the list.html file that goes along with that controller

All html files are put into $templateCache. In the module A scripts, I see

$templateCache.put("app/components/defaults/list.html","<div ... etc

module B wants to use the listController and html from module A. So, module A is defined as a dependency.

Module B has a route defined as so

$stateProvider.state('myState', {
        "name": "mystate",
        "url": "/mystate",
        "templateUrl": "/app/components/defaults/list.html",
        "controller": "ListController",
        "controllerAs": "vm",
        "service": "SomeService"
    });

when accessing this route, I see that I get

GET https://myhost/app/components/default/list.html 404 (Not Found)

what am I missing ?

thanks !

jmls
  • 2,879
  • 4
  • 34
  • 58

2 Answers2

1

The difference is the leading / in templateUrl that doesn't exist in the $templatCache path.

The strings need to match an === comparison , the same way any object property name would

charlietfl
  • 170,828
  • 13
  • 121
  • 150
0

soooo, at the risk of publicly ridiculing myself ...

The solution is to actually, really include module A as a dependency. Not module C ...

Sorry for the waste of time and bandwidth.

jmls
  • 2,879
  • 4
  • 34
  • 58