@Sherbadshah wrote:
var host = 'http://' + store.get("host") + '/easyway/';
angular.module('starter.controllers', [])
.controller('MenuCtrl', function($scope, $ionicModal, $timeout) {
$scope.exit = function() {
if (confirm("Are you want to exit the app ?")) {
ionic.Platform.exitApp();
}
}
})
///////////////////////Home controller /////////////////////////////////////.controller('HomeCtrl', function($scope, $http) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////// checking online status and host //////////////////////////////////////////////// ////////////////////////////////////////////////// // ////////////////////////////////////////////////////// $http.get(host + '/api/zubair/api.php?online') .then( function(e) { console.log(e); if (!e.data) { var input = prompt("Unknown host please enter host name"); store.set("host", input); host = 'http://' + input + '/easyway/'; } }, function(e) { var input = prompt("Unknown host please enter host name"); store.set("host", input); host = 'http://' + input + '/easyway/'; } );
})
/////////////////////Order controller ///////////////////////////////////
.controller('OrdersCtrl', function($scope, $http) {
////////////////////////////////Displaying Records From Database/////////////////////////////////////////////////////// $http.get('http://localhost/api/zubair/api.php') .then(function(response) { $scope.names = response.data.records; ////////////////////////////////Search //////////////////////////////////////////////////////////////////////////////// $scope.search = ''; ///////////////////////////////Sending SMS //////////////////////////////////////////////////////////////////////////// $scope.send_sms = function() { // alert(no); var options = { replaceLineBreaks: false, android: { intent: '' } }; var msg = prompt("Enter text msg"); $cordovaSms sms.send("03059084920", msg, options, function() { alert("Success"); }, function(err) { alert("Error"); }); } }) }) .controller('HelpCtrl', function($scope, $stateParams) {}) .controller('AboutCtrl', function($scope, $stateParams) {});
Posts: 2
Participants: 2