Hey there,
Is there anything i need to add this app.js file to make this pin unlock app start automatically when the phone is switched on?
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// ‘starter’ is the name of this angular module example (also set in a attribute in index.html)
// the 2nd parameter is an array of 'requires’
var exampleApp = angular.module(‘starter’, [‘ionic’])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
exampleApp.controller(‘UnlockController’, function($scope, $location, $timeout,$ionicPopup) {
$scope.init = function() {
$scope.pass = "";
}
$scope.add = function(value) {
if($scope.passcode.length < 4) {
$scope.pass = $scope.passc + value;
var password = 1256;
if(($scope.pass.length == 4) && ($scope.pass == password)) {
var passReset = 'Do you want to reset password?';
var quitApp = 'Quit';
var alert = $ionicPopup.alert({
title:'Feedback',
template: 'Successful Aunthentication!!',
buttons: [
{
text:'Reset Password',
onTap: function(e){
passReset = 'Do you want to reset password?';
return true;
}
},
{
text:'Quit',
type: 'button-positive',
onTap: function(e){
quitApp = 'Quit';
ionic.Platform.exitApp();
navigator.app.exitApp();
return true;
}
}
]
})
$timeout(function() {
console.log("The four digit code was entered");
}, 500);
}else if(($scope.pass.length == 4)){
var alert = $ionicPopup.alert({
title:'Feedback',
template: 'Invalid login attempt!!'
})
}
}
}
$scope.delete = function() {
$scope.delete = function() {
if($scope.pass.length > 0) {
$scope.pass = $scope.pass.substring(0, $scope.pass.length - 1);
}
}
}
});