Today We 're gonna start to write some code , first is make a main controller to our ionic application , of course by controller i mean angularjs controller . we start by add ng-controller to our body tag , but this is just a reference to controller we need also to create this controller (MainController) . The idea is just use http call to get the data.json AngularJS comes with built in $ http service to make (GET,UPDATE,POST,DELETE) in our case we are are doing get call app.controller('MainController',function ($scope,$http) { // body... $http.get("data.json") .then(function(response) { console.log(response) }); }) we are just login data in the console. NB : the http call could make some time before it returns the data in , our case we are working localy, but in real life we have to work with web services and probably internet connection like mine lol, you guessed it, we need to use some techniq
Comments
Post a Comment