0

Im trying to catch the variables fromcontroller to use it in the view. but it wont work, but i do know that it exists ( debug on the picture below).

problem: I dont get anything in the view.

note: it might be cause the structure, main structure is from: https://github.com/meanjs/mean

response:

nothing

my view:

<body class="ng-cloak" ng-controller="HeaderController as aux">

trying to get it to work:

        <div class="cometchat_name">{{ varselmessage }} {{ aux.varselmessage }}</div>

function:

    (function () {
  'use strict';

  angular
    .module('core')
    .controller('HeaderController', HeaderController);

  HeaderController.$inject = ['$scope', '$state', 'Authentication', '$rootScope','Socket'];

  function HeaderController($scope, $state, Authentication, $rootScope,Socket) {

    var aux = this;

    $scope.datatest = 200001;
    $rootScope.datatest = 900;

    $scope.varselmessage = 'varsel';
    aux.varselmessage = 'varsel2';

    $scope.notifications = [{text: " melding" , image : "kapring"}];
    console.log("loaded , maybe possible4?");

  }
}());

7
  • any errors in the console? Commented Sep 13, 2016 at 16:38
  • hmm try to paste more code, are you using routing? Commented Sep 13, 2016 at 16:44
  • Yea, but I want this controller to run on body. I linked to the structure I'm using Commented Sep 13, 2016 at 16:45
  • with the code provided can only guess, try to remove the controller as syntax Commented Sep 13, 2016 at 17:05
  • no difference @Akis Commented Sep 13, 2016 at 17:05

1 Answer 1

1

Problem is with the module, you are missing the dependency injection part [],

  angular
    .module('core',[])
    .controller('HeaderController', HeaderController);

DEMO APP

Sign up to request clarification or add additional context in comments.

5 Comments

i think something in my structure is blocking it. Could you take a look? ( in 2 days im setting a 100 bounty on this too)
@maria actually i dont get your issue! your issue is the values are not showing in the view right?
so that is what fixed with the demo application, can you have a look?
yeah i see it works in the demo. But i did the same thing, and it wont work for some reason.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.