Let's build a mobile application with Ionic Framework #3
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 techniques and tips for that, such as displaying loader , error messages, .. fortunately Ionic integrated magic components .
in the next part we are going to display this data as a ionic card and adding loading to our app
, 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 techniques and tips for that, such as displaying loader , error messages, .. fortunately Ionic integrated magic components .
in the next part we are going to display this data as a ionic card and adding loading to our app
ReplyDeleteToday's Best article. It really helps me to enhance my skills.
AWS Training in Chennai
DevOps Training in Chennai
Java Training in Chennai
AngularJS Training in Chennai
German Classes in Chennai
German Language Classes in Chennai
German Language course in Chennai
tütün sarma makinesi
ReplyDeletesite kurma
sms onay
binance hesap açma
JQ4N