angular js module call order run() config()

Here’s the calling order: app.config() app.run() directive’s compile functions (if they are found in the dom) app.controller() directive’s link functions (again if found) Here’s a simple demo where you can watch each execute (and experiment if you’d like). From Angular’s module docs: Run blocks – get executed after the injector is created and are used…

$q and $promise in angularjs

$q and $promise The traditional way to deal with asynchronous tasks in Javascript are callbacks; call a method, give it a function reference to execute once that method is done. 1 2 3 $.get(‘api/gizmo/42’, function(gizmo) {   console.log(gizmo); // or whatever }); This is pretty neat, but, it has some drawbacks; for one, combining or chaining…

deploy nodejs angularjs mongodb expressjs application to openshift

In my previous post, I described how to upload file using nodejs and angularjs. Now we are to deploy this MEAN stack app to openshift which is a very good cloud service provider offering 3 application deployment for free. You can even deploy Java web application to it using Tomcat/Mysql, part of which i mentioned…

authentication angular nodejs with JWT

Why use it? Here are some advantages of choosing JWT: Standard: JWT is becoming a standard, and there a multiple libraries for a lot of languages (Ruby, Java, Python, Node, Backbone). So the integration with your language or technology should be pretty easy. Cross-domain / CORS: Since the information is transmitted using an HTTP header, you are…

understanding and using jsonp

JSONP is really a simple trick to overcome the XMLHttpRequest same domain policy. (As you know one cannot send AJAX (XMLHttpRequest) request to a different domain.) So – instead of using XMLHttpRequest we have to use script HTML tags, the ones you usually use to load js files, in order for js to get data…

understanding the angular js $resource

$Resource Basic At first sight AngularJS seems like a magical framework, which does some weird but awesome things like dependency injection, data binding only by setting a single property to the magical object named $scope and many other things. If you look at the source code of Angular you’ll see a lot of smart and…