Post/Code

HomeAboutUsesNow

VS Code Auto format, AngularJS $state, $stateChangeSuccess & Angular Translate.

  • VS Code auto format code: ALT + SHIFT + F
  • AngularJS $state.current to get the current route
  • AngularJS $stateChangeSuccess for UI-Router < 1.0 | Link

    $rootScope.$on('$stateChangeSuccess', 
    function(event, toState, toParams, fromState, fromParams){ ... });
  • Angular Translate service | Link

    $translate('HEADLINE').then(function (headline) {
    $scope.headline = headline;
    }, function (translationId) {
    $scope.headline = translationId;
    });