Does Angular need a web server to run? So would Angular work if I give browser a url of a local file?

前端 未结 5 1268
无人共我
无人共我 2021-02-12 10:55

By this I mean I have read that Angular allows mock up data to be used so that RESTFul apis need not be wired up. I can think of a use case where a UX designer need only look a

5条回答
  •  故里飘歌
    2021-02-12 11:22

    You cannot just access an angular application by the filepath on the local machine because you will get cross origin domain errors.

    The solution is to install http-server (which requires node.js to be installed). This allows you to create a http-server local to your machine and will allow you to access the Angular application as if it were hosted online for development and test purposes.

提交回复
热议问题