Hi I am newbie to Angular, Ionic. Trying to learn with practice. I have a contoller on my controllers file something like that:
And I have a content pages which all of them runs this controller. Content is something like this:
.controller('GuideCtrlx', ['$scope', '$http', function($scope, $http) {
var city = "London";
$http.jsonp("https://en.wikipedia.org/w/api.php?format=json&action=parse&page=" + city + "&prop=text§ion=0&callback=JSON_CALLBACK").
success(function JSON_CALLBACK(data) {
//stuff goes here
})
}])
<ion-view title="Cart" id="page2" style="">
<ion-content padding="true" class="has-header">
{{ }}
</ion-content>
</ion-view>
I want to call controller function on every page with different city name to get data. Tried to add ng-init to <ion-content not worked. I have two questions.
1. How to pass value to controller function from a content page mentioned above?
2. How to show content only after getting function result?
Any help will be appreciated.