I'm new in Angular and I'm using ngRoute. Here is my routing:
var balaitus = angular.module('balaitus', ['ngAnimate', 'ngSanitize', 'ui.bootstrap','ngRoute']);
balaitus.controller('GlobalController', function ($scope) {
$scope.isNavCollapsed = true; // Para que se colapse la barra
$scope.selected_account = '';
});
balaitus.config(function($routeProvider){
$routeProvider
.when("/", {
controller: "GestionCuentas",
templateUrl: "gestion_cuentas.html"
})
.when("/cuentas", {
controller: "GestionCuentas",
templateUrl: "gestion_cuentas.html"
})
.when("/hastags_and_users", {
controller: "HastagsAndPersonas",
templateUrl: "hastags_y_personas.html"
})
.when("/estadisticas", {
controller: "EstadisticasController",
templateUrl: "estadisticas.html"
});
});
Now I'm in the controller "GestionCuentas" and I want to change $scope.selected_account that is in the GlobalController. I have tried The most intuitive which is $scope.selected_account = newValue; but this didn't work. Also I have tried the same with $rootscope but this hasn't worked. How can I get this?
Aucun commentaire:
Enregistrer un commentaire