$rootScope.app is Undefined

Asked

Viewed 24 times

0

People,

I asked for help to rescue the value of a variable in a js file by the $rootScope that is in the controller of my application. My intention is to rescue in the page hmtl this attribute to be able to display on the screen the system version.

When running the application the message occurs: $rootScope.app is Undefined

infoBuild

var VERSAO_SISTEMA = '01.02.00.002'; 

Controller

angular.module('webapp') . controller('Imrcontroller'',

    function ($scope, $rootScope, $translate, $http, $timeout, Log, WebServiceX, Alert, Analytics, Error, Utils, WebServiceRest, WebServiceT) {

    Log.debug("ImrController()");
    Analytics.trackEvent('controller','ImrController');
    $scope.container = {};     
    $rootScope.currentview.id = 'iMR';
    $rootScope.currentview.group = 'IMR';
    $rootScope.currentview.title = 'IMR';
    $rootScope.currentview.icon = 'fa-list-alt';
    $rootScope.currentview.locked = false;
    $rootScope.currentview.menu = true;
    $rootScope.currentview.description = 'IMR';
    $rootScope.app.version.id= VERSAO_SISTEMA;

    //Preenchimento da data da ultima carga
    $http.get('/siigf/ws/imr/dataUltimaCarga').
    then(function(response) {
         $scope.dataUltimaCarga = response.data;
    });

Html

{{app.name}}{{app.version.id}}

{{app.version.name}}

I also imported the infoBuild.js file into index.html

The project is in angular JS

Thank you!

  • You injected $rootScope into your module?

  • Hello good afternoon. First it is not good to use rootscope or Scope, prefer to use the implementation standard with angular.extend. For example instead of :

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.