No data in view after creating a factory

前端 未结 3 503
无人及你
无人及你 2020-12-21 22:29

It\'s my 2nd day learning AngularJS. I have a problem I can\'t tackle. Everything was working fine until I created a factory. I understand that factories/services are used t

相关标签:
3条回答
  • 2020-12-21 23:09

    As you are asking for a templateUrl from the $routeProvider definition on basis of $route definition. It asks for template from the folder which will making ajax with file:// protocol which does gets failed. And it is getting failed as protocol file:// doesn't accessible via ajax $http.

    For fixing this You need to host your code on some server like Apache/LAMP/WAMP server, so that your folder will hosted & it will have an http:// protocol.

    0 讨论(0)
  • 2020-12-21 23:12

    I think there's just a typo between CustomersFactory and CustomerFactory now.

    0 讨论(0)
  • 2020-12-21 23:22

    I would recommend http-server as a quick and easy solution to run your application upon and to help resolve your file loading issues:

    https://www.npmjs.com/package/http-server

    0 讨论(0)
提交回复
热议问题