Promise sample for Cross-Platform mobile application class
How do I make an promise sample for cross-platform mobile application class?
What is a promise sample for cross-platform mobile application class? How do you make a promise sample for cross-platform mobile application class? This script and codes were developed by Aaron K Saunders on 25 September 2022, Sunday.
Promise sample for Cross-Platform mobile application class - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Promise sample for Cross-Platform mobile application class</title>
</head>
<body> <html> <head> <title>Simple App - Binding</title> <!-- see https://getbootstrap.com/css/ --> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script> </head> <body ng-app="smallApp" class="container" > <div ng-controller="MyController"> {{ progress }} </div> </body>
</html> <script src="js/index.js"></script>
</body>
</html>
Promise sample for Cross-Platform mobile application class - Script Codes JS Codes
//
// Promise sample for Cross-Platform mobile application class
//
// promises as an alternative to callbacks as a primier for
// discussing promise in $http and angular-resource
// create the angular app module
angular.module('smallApp',[])
// create the angular controller module .controller( 'MyController', function ($scope, $q) { $scope.progress = []; function logInToSystem() { var deferred = $q.defer(); deferred.resolve("logged in"); return deferred.promise; } // use the information from previous call ( logInToSystem ) // to process checkForData, promises return one object which // will be passed to the next promise/function in the chain function checkForNewData(_loginInfo) { var deferred = $q.defer(); $scope.progress.push(_loginInfo) deferred.resolve("got the data"); // if reject, the error will get caught // in the catch block and processing will // end - deferred.reject("got the data"); return deferred.promise; } // now that you are loggedin and you have the // data you can actually display the data function displayTheData(_newDataInfo) { var deferred = $q.defer(); $scope.progress.push(_newDataInfo) deferred.resolve( "this is the data"); return deferred.promise; } // there are a set of steps that have a dependency on one // another, we can manage that process through promises return logInToSystem() .then(checkForNewData) .then(displayTheData) .then(function(_response){ $scope.progress.push(_response) }).catch(function(_error){ alert("Error Processing data " + _error); });
});
Developer | Aaron K Saunders |
Username | aaronksaunders |
Uploaded | September 25, 2022 |
Rating | 3 |
Size | 2,214 Kb |
Views | 30,360 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Angular2 Http Example | 3,851 Kb |
Google Map Directive in Ionic | 3,479 Kb |
Demo ui-router basic state change | 2,042 Kb |
A Pen by aaron k saunders | 2,916 Kb |
Ionic 2 Tabs Starter | 3,059 Kb |
Nested ng-repeat in AngularJS with Checkboxes | 2,600 Kb |
A Pen by aaron k saunders | 4,143 Kb |
Using ui-router to control application flow | 3,448 Kb |
A Pen by aaron k saunders | 2,286 Kb |
Proper way to manage ng-options selections | 2,114 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Cloudy Spiral CSS animation | Hakimel | 6,587 Kb |
Pure CSS Spinners | Jlong | 2,043 Kb |
CSS Org Chart | Appirio-ux | 3,882 Kb |
Page Transitions in Backbone | Mikefowler | 3,691 Kb |
Expandable Left Side Bar with jQuery animate | Retrofuturistic | 2,483 Kb |
A Pen by Stan Williams | Stanssongs | 6,706 Kb |
Codero Sitemap | S1m0ne | 28,169 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 Kb |
Css Rotating 3d cubes different speed | Dghez | 2,364 Kb |
Rain Landing in a Pond | Edball | 3,009 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!