Is there any way to check user Agent in ionic

i read that navigator.userAgent is not preferable to use to check user agent so is there any other way to identify the device whether it is iOS or Android…

Check out ionic.platform

http://ionicframework.com/docs/api/utility/ionic.Platform/