AnuglarUI Typeahead Work with Objects instead of SoureArray

The thing to ntice about the typeahead directive from http://angular-ui.github.io/bootstrap/ is that tries to mimic syntax used by the select directive from AngularJS. It means that all the expressions used to select a model to bind and a label are AngularJS expressions. This is turns means that you can use whatever AngularJS expression to calculate […]

Continue reading


AngularJS: Global Variables Sharing between Controllers

We have got basically 2 options for “global” variables: use a $rootScope http://docs.angularjs.org/api/ng.$rootScope use a service http://docs.angularjs.org/guide/dev_guide.services 1. $rootScope $rootScope is a parent of all scopes so values exposed there will be visible in all templates and controllers. Every application has a single root scope. All other scopes are descendant scopes of the root scope. […]

Continue reading


AngularJS: Service vs Factory vs Provider

From the Angular 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: […]

Continue reading


AngularUI: Custom Events on Angular-UI Tooltip

Twitter Bootstrap tooltips (that Angular-UI relies upon) have an option to specify the trigger event with an additional attribute as in data-trigger=”mouseenter”. This gives you a way of changing the trigger programmatically (with Angular):

So when button was selected, mls.isSelected=true then the tooltip-trigger expression will evaluate to mouseenter and tooltip will show up. Otherwise, […]

Continue reading


AngularJS: Practices in CCR Project

Catculate the expire days

Catculate the age

Add timestamp to image for clear browser cache

Convert date format between “YYYY-MM-DD” and “DD/MM/YYYY”

Convert datetime to be format “YYYY-MM-DD”

Get 7 days past and after by today

Validation before the object post

Continue reading


AngularUI: Editable Cell Blur Event Triggered Using ng-grid

Here is to provide two methods to trigger blur event for editable cell using ng-grid Methods 1: Default Callback Function in ng-grid In ng-grid, there is a default callback function which name ngGridEventEndCellEdit in line 2907 of github.com version 2.0.7 source file. The screenshot as below:

Methods 2: Customize the focus & blur Event […]

Continue reading


AngularUI: Get the Cell Value from ng-grid by Clicked or Selected

Use the afterSelectionChange callback function to trigger the event after clicked or selected Then, we can try to console.log the this object

this in the afterSelectionChange callback function represents the current cell clicked or selected from ng-gird. It has the entity object which contains the value of the cell. so we can call this.entity.VALUE […]

Continue reading