concept location in category ionic

This is an excerpt from Manning's book Ionic in Action: Hybrid Mobile Apps with Ionic and AngularJS.
This very simple controller just assigns the array of locations to the scope. You don’t need to do anything more complex in the controller, but you do need to add this controller to the side menu template. In the www/index.html file, update the ionSideMenu and add the ngController directive to attach this new controller to the side menu:
<ion-side-menu side="left" ng-controller="LeftMenuController">You haven’t used ngController in your Ionic apps, but you did use it in the chapter 3 primer on Angular. Normally, you declare the controllers for each view in your app config() using the $stateProvider. In this case, the side menu isn’t its own state, so you have to attach the controller yourself. With this controller, the side menu now will have access to the list of locations, so you can update the list to loop over the favorites.
Here you use Angular services to help define a service that can be shared between different controllers. Later you’ll add each of these to different views, but any changes made to these services will be immediately reflected in other views. If you recall from chapter 5, you used the same technique for the list of currencies, where each currency could be toggled on or off and the changes would be reflected instantly across the app. You’ll use Locations.data as the array that stores the list of locations, which should contain the city name, latitude, and longitude values. To start, I’ve preset Chicago in the list because it’s one of my favorite cities.
The Locations service has three methods. The getIndex() method gives you the index value of an item from the Locations.data array, if the item exists. The toggle() method will add or remove a location from the Locations.data array, after it checks if the location is already in the Locations.data array or not. The primary() method is used to either add a new item to the top of the list, or to move an existing item to the top of the list.