danishwebindia Posted October 30, 2014 Share Posted October 30, 2014 My Customers.JSON file in root folder. its not working. My code is <div ng-controller="personName"> <input type="text" ng-model="test" /> <ul class="list-unstyled"> <li ng-repeat="x in names | orderBy:'Name' | filter:test">{{x.Name+' '+x.City}}</li> </ul> </div> <script type="text/javascript"> function personName($scope,$http){ $http.get('Customers.JSON').success(function(response){$scope.names=response;}); } </script> Link to comment Share on other sites More sharing options...
justsomeguy Posted October 30, 2014 Share Posted October 30, 2014 What do you mean it's not working, what happens? Are you checking for Javascript errors in the developer console? Link to comment Share on other sites More sharing options...
danishwebindia Posted October 30, 2014 Author Share Posted October 30, 2014 it work when the json file is online. it is not working in local folder. javascript code is fine. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 30, 2014 Share Posted October 30, 2014 Your browser might have a security restriction to not load local files with Javascript. If you just double-click on a file to open it in a browser it will run with a restricted set of permissions. You might want to install a local test server so that you can run it through a server locally. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now