ionic-Material Design , Codecanyon
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<!--View Information-->
|
||||
<!--View name : Device Vibration-->
|
||||
<!--Controller name : vibrationCtrl-->
|
||||
<!--Controller path : www/templates/hardware-connect/vibration/js/controllers.js-->
|
||||
<!--State name : app.vibration-->
|
||||
<!--URL : #app/vibration-->
|
||||
|
||||
<ion-view title="Vibration">
|
||||
<!--vibration section-->
|
||||
<ion-content scroll="false">
|
||||
|
||||
<div class="row">
|
||||
<!--vibration icon section-->
|
||||
<div id="vibration-icon" class="col">
|
||||
<i ng-class="{'vibration-sad-color' : vibrateing}"
|
||||
class="ion-android-happy center-screen icon-vibration"></i>
|
||||
</div>
|
||||
<!--end vibration icon section-->
|
||||
</div>
|
||||
<div class="row">
|
||||
<!--vibration control section-->
|
||||
<div id="vibration-control" class="col">
|
||||
<p>Devise Vibration</p>
|
||||
<a class="md-raised md-warn md-button md-default-theme" ng-click="vibrate()">
|
||||
Vibrate
|
||||
</a>
|
||||
</div><!--end vibration control section-->
|
||||
</div>
|
||||
</ion-content><!--end vibration section-->
|
||||
</ion-view>
|
||||
@@ -0,0 +1,31 @@
|
||||
// For using vibration you have to install $cordovaVibration by running the following
|
||||
// command in your cmd.exe for windows or terminal for mac:
|
||||
// $ cd your_project_path
|
||||
// $ ionic plugin remove cordova-plugin-vibration
|
||||
// $ ionic plugin add cordova-plugin-vibration
|
||||
//
|
||||
// Learn more about $cordovaVibration :
|
||||
// http://ngcordova.com/docs/plugins/vibration/
|
||||
//
|
||||
// Controller of vibration page.
|
||||
appControllers.controller('vibrationCtrl', function ($scope, $timeout, $cordovaVibration) {
|
||||
|
||||
// initialForm is the first activity in the controller.
|
||||
// It will initial all variable data and let the function works when page load.
|
||||
$scope.initialForm = function () {
|
||||
// $scope.vibrateing is vibrateing status.
|
||||
$scope.vibrateing = false;
|
||||
};
|
||||
|
||||
// vibrate for vibrate by calling $cordovaVibration.vibrate(milliseconds of vibrateing)
|
||||
$scope.vibrate = function () {
|
||||
$scope.vibrateing = true;
|
||||
$cordovaVibration.vibrate(400);
|
||||
$timeout(function () {
|
||||
$scope.vibrateing = false;
|
||||
}, 400);
|
||||
};// End vibrate.
|
||||
|
||||
$scope.initialForm();
|
||||
|
||||
});// End of vibration Controller.
|
||||
Reference in New Issue
Block a user