Promise #1

In this example below you will see how to do a Promise #1 with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by zax75, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright zax75 ©
  • HTML
  • CSS
  • JavaScript
        <html ng-app="app">
  <head></head>
  <body ng-controller="controller">
  </body>
</html>
    

/*Downloaded from https://www.codeseek.co/zax75/promise-1-qaOBjq */
        
    

/*Downloaded from https://www.codeseek.co/zax75/promise-1-qaOBjq */
        angular
  .module('app', [])
  .controller('controller', function($q){
    console.log('inizio controller');
    var promise = $q.when('valore');
    promise
      .then(function(value){ console.log(value); return value + '!'; })
      .then(function(value){ console.log(value); });
    console.log('fine controller');
})

    

Comments