How to access the value of a promise?

promiseA‘s then function returns a new promise (promiseB) that is immediately resolved after promiseA is resolved, its value is the value of the what is returned from the success function within promiseA. In this case promiseA is resolved with a value – result and then immediately resolves promiseB with the value of result + 1. … Read more

AngularJS: Service vs provider vs factory

From the AngularJS mailing list I got an amazing thread that explains service vs factory vs provider and their injection usage. Compiling the answers: Services Syntax: module.service( ‘serviceName’, function ); Result: When declaring serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService(). Factories Syntax: … Read more

What are the nuances of scope prototypal / prototypical inheritance in AngularJS?

Quick answer: A child scope normally prototypically inherits from its parent scope, but not always. One exception to this rule is a directive with scope: { … } — this creates an “isolate” scope that does not prototypically inherit. This construct is often used when creating a “reusable component” directive. As for the nuances, scope … Read more