I'm very new to using ionic/AngularJS and I was wondering how exactly to use ionic.Platform to print the current device. Right now I have
var currentPlatform = ionic.Platform.platform();
in my main.html ctrl. Is there a way to send it to the html page, or am I approaching it completely wrong?
from your controller data send to view use application model $scope , means just assign your variable to scope variable and get it directly where you call your controller in view.
Example :
angular.module('scopeExample', ['ionic'])
.controller('MyController', ['$scope', function($scope) {
var currentPlatform = ionic.Platform.platform();
$scope.currentPlatform = currentPlatform;
}]);
and in view you access
<body ng-app="scopeExample">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content ng-controller="MyController">
{{currentPlatform }}
</ion-content>
</ion-pane>
</body>
For more details refer following links :
Hopes this will help you.