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!