Skip to content

Instantly share code, notes, and snippets.

View rvillars's full-sized avatar

Roger Villars rvillars

View GitHub Profile
@rvillars
rvillars / GetCurrentProject.java
Last active August 29, 2015 14:16
Intellij Plugin Code Snippets
finalAsyncResult<DataContext>dataContext=DataManager.getInstance().getDataContextFromFocus();
finalProjectproject=DataKeys.PROJECT.getData(dataContext.getResult());
@rvillars
rvillars / README.md
Last active March 22, 2016 12:31
Preprocess directive attributes in AngularJS

Preprocess directive attributes in AngularJS

Sometimes you need to modify a two way binded attribute value prior to use it in the directive. This can't be done in the directive controller, because the attribute assignment is done after the controller is executed.

The link function is able to access the attributes directly but unfortunately a two way binded attribute expression isn't yet evaluated a that time.

The solution is to process the attribute in a scope.$watch function where the value will be evaluated automatically.

http://jsfiddle.net/gh/gist/angularjs/1.2.1/d60d9416f2206c6e3407/

@rvillars
rvillars / README.md
Last active February 25, 2020 09:26
[Angular Translate Bunlde] Spring bundle based translations (i18n) for AngularJS applications with angular-translate

angular-translate with Spring bundles

Synopsis

AngularJS itself doesn't provide any features to translate the texts of your application to different languages and switching the language right on the page. Fornutalty there is now another open-source project called angular-translate that implements the needed functionalities.

AnularJS proposes a technologiy where as much as possible application behevior is exeuted on the client (the browser). So it makes sense to hold translated texts clientside and enrich the static templates with the transalted texts there.

Spring message bundles in the opposite are a collection of serverside key=value files that hold the translated texts each for one language. A well known and widly used pattern.