How to find device os and version in ionic

后端 未结 4 453
半阙折子戏
半阙折子戏 2021-01-24 09:27

I have worked on few tutorials and at last found something regarding this in ionic framework.....

They gave some codes that use ionic native and i did the same by embedd

4条回答
  •  忘了有多久
    2021-01-24 09:58

    Please see this link http://ionicframework.com/docs/api/utility/ionic.Platform/

    angular.module('PlatformApp', ['ionic'])
    .controller('PlatformCtrl', function($scope) {
    
      ionic.Platform.ready(function(){
        // will execute when device is ready, or immediately if the device is already ready.
      });
    
      var deviceInformation = ionic.Platform.device();
    
      var isWebView = ionic.Platform.isWebView();
      var isIPad = ionic.Platform.isIPad();
      var isIOS = ionic.Platform.isIOS();
      var isAndroid = ionic.Platform.isAndroid();
      var isWindowsPhone = ionic.Platform.isWindowsPhone();
    
      var currentPlatform = ionic.Platform.platform();
      var currentPlatformVersion = ionic.Platform.version();
    
      ionic.Platform.exitApp(); // stops the app
    });
    

提交回复
热议问题