This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<profile data=”user”></profile> | |
scope : { local_data: “=data” } //using alias | |
scope : { data: “=” } //abbreviation when using identical names | |
//Usage: | |
// local_data = 1; | |
// data = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<profile id=”1"></profile> | |
scope : { local_id: “@id” } //using alias | |
scope : { id: “@” } //abbreviation when using identical names | |
//Usage: | |
// var profile_id = local_id; | |
// var profile_id = id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<profile id="1"></profile> | |
scope : { local_id: “@id” } //using alias | |
scope : { id: “@” } //abbreviation when using identical names | |
//Usage: | |
// var profile_id = local_id; | |
// var profile_id = id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope: true | |
//Usage: | |
// var setting = $scope.$parent.setting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module(“myapp”, [‘pascalprecht.translate’]) | |
.config(function ($translateProvider) { | |
//default language | |
$translateProvider.preferredLanguage(‘en’); | |
//fallback language if entry is not found in current language | |
$translateProvider.fallbackLanguage(‘es’); | |
//load language entries from files | |
$translateProvider.useStaticFilesLoader({ | |
prefix: ‘’, //relative path Eg: /languages/ | |
suffix: ‘.json’ //file extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!— html code → | |
<select ng-model=”selectedLanguage” ng-change=”changeLanguage()”> | |
<option value=”en” translate=”global_language_en”></option> | |
<option value=”es” translate=”global_language_es”></option> | |
</select> | |
//controller | |
.controller(“Controller”, function($scope, $translate) { | |
//variable to store selected language | |
$scope.selectedLanguage = $translate.proposedLanguage(); //default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 translate=”title”></h1> | |
<h1>{{title | translate}}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!— this is set to the DOM element → | |
<a href=”#” class=”myclass another” id=”1" onclick=”alert(this.id + ‘ ‘ + this.className)”>DOM element</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!— this is set to the DOM element --> | |
<a href="#" class="myclass" another” id="1" onclick="alert(this.id + ‘ ‘ + this.className)">DOM element</a> |