Ionic framework 如何使用离子平台
我对使用ionic/AngularJS非常陌生,我想知道如何准确地使用ionic.Platform打印当前设备。现在我有Ionic framework 如何使用离子平台,ionic-framework,ionic,device-detection,Ionic Framework,Ionic,Device Detection,我对使用ionic/AngularJS非常陌生,我想知道如何准确地使用ionic.Platform打印当前设备。现在我有 var currentPlatform = ionic.Platform.platform(); 在my main.html中,按ctrl键。有没有办法将其发送到html页面,或者我的做法完全错误 从控制器数据发送到视图使用应用程序模型$scope,意味着只需将变量分配给scope变量,并直接从视图中调用控制器的位置获取变量 示例: angular.module
var currentPlatform = ionic.Platform.platform();
在my main.html中,按ctrl键。有没有办法将其发送到html页面,或者我的做法完全错误 从控制器数据发送到视图使用应用程序模型$scope,意味着只需将变量分配给scope变量,并直接从视图中调用控制器的位置获取变量 示例:
angular.module('scopeExample', ['ionic'])
.controller('MyController', ['$scope', function($scope) {
var currentPlatform = ionic.Platform.platform();
$scope.currentPlatform = currentPlatform;
}]);
并在视图中访问
<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>
离子空白起动器
{{currentPlatform}}
有关更多详细信息,请参阅以下链接:
等
希望这能对你有所帮助