For a multiple view Ionic app, the controller for the state is attached to <ion-content> directive or tag. A few lines below are usually included in individual template (html) - note you don't need to add ng-controller attribute. <ion-view view-title="Home"> <ion-content ng-controller="HomeCtrl"> <!-- The content of the page --> </ion-content> </ion-view> Caching By default, … Continue reading On Ionic view caching and its effect
AngularJS
What is the lifecycle of an AngularJS Controller?
Can someone please clarify what the lifecycle of an AngularJS controller is? Is a controller a singleton, or created / destroyed on demand? If the latter, what triggers the creation / destruction of the controller? Consider the below example: var demoApp = angular.module('demo') .config(function($routeProvider, $locationProvider) { $routeProvider .when('/home', {templateUrl: '/home.html', controller: 'HomeCtrl'}) .when('/users',{templateUrl: '/users.html', controller: … Continue reading What is the lifecycle of an AngularJS Controller?
Posting Form Data With $http In AngularJS
By default, when you go to post data in an AngularJS application, the data is serialized using JSON (JavaScript Object Notation) and posted to the server with the content-type, "application/json". But, if you want to post the data as a regular "form post," you can; all you have to do is override the default request … Continue reading Posting Form Data With $http In AngularJS
Angular $http POST request with request payload or form data
If you have RESTful API's on your server side and are trying to use Angular's $http service to consume the resource, you should be careful about how the request (for example, Http POST) is made, in particular how the data (perhaps in the format of form) is included in the request. As a JSON object … Continue reading Angular $http POST request with request payload or form data