Home  >  Article  >  Web Front-end  >  Angular gets the json file defined in the project

Angular gets the json file defined in the project

一个新手
一个新手Original
2017-10-17 09:42:191532browse

Project structure:

The folder js is located in the root path


1 $http.get('js/app/contact/contacts.json').then(function (res) {
2     /*下面就是获取到的数据*/
3     $scope.contactsData = res.data;
4   });

The request address starts from the root path to the requested file

The above is the detailed content of Angular gets the json file defined in the project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn