A Message Box Modal

Message box is widely used in each website. So I created a Message Box Modal using bootstrap and AngularJS for re-usability. I want the user to put such a single HTML to use the message box: <c-msgbox msgbox-show=”showNavMsgbox” msgbox-done=”doneNavMsgbox” msgbox-name=”navMsgbox”></c-msgbox> Here msgbox-show attribute is the name of msgbox showing event, msgbox-done attribute is the name of msgbox returning event, …

Read More

Promises in AngularJS

Reference: https://segmentfault.com/a/1190000002788733 As has mentioned in the previous post, promise is a way that can handle asynchronous tasks.  promise is an object that represents the value or exception that a function may return. Please refer to Asynchronous JavaScript – Promises. Using Promise in AugularJS To use  promise in AngularJS, you need to use the built-in service: $q. We can use defer() method in $q to create …

Read More

Sharing Data Between Controllers in AngularJS

Reference: http://stackoverflow.com/questions/21919962/share-data-between-angularjs-controllers Sharing data between controllers is quite common when using AngularJS. There are many ways that can make it: Scope inheritance Using services Using event Scope inheritance Scope inheritance has been mentioned in Passing Data Between Parent/Child Scopes in AngularJS. You can only share data between parent and child controllers by this way. Here is a simple example: In Html: …

Read More

Understanding Scopes in AngularJS

Reference: https://github.com/angular/angular.js/wiki/Understanding-Scopes In AngularJS, a child scope normally prototypically inherits from its parent scope. One exception to this rule is a directive that uses scope: { … } — this creates an “isolate” scope that does not prototypically inherit.(and directive with transclusion) This construct is often used when creating a “reusable component” directive.  Scope inheritance is normally …

Read More

Passing Data Between Parent/Child Scopes in AngularJS

Reference: http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs 1. The problem Scope in AngularJS is a bit tricky. When we are using nested controller in AngularJS, since each controller has its own scope,  the nesting of controller means the nesting of scope. If there are two models with the same name both in the parent and child scope, what will happen? Can we …

Read More