0

How can I share the scope with angular ui router ? I tried this :

angular.module('myApp').controller('detailCtrl', ['$scope',
    function($scope) {
 $scope.test=$scope.$parent.services;


angular
  .module('myApp', ['ngAnimate', 'ngCookies', 'ngResource'
                  , 'ui.router', 'ngSanitize', 'ngTouch'])
  .config ($stateProvider) ->
    $stateProvider.state('home',
      url: "/"
      templateUrl: "home.html"
    ).state('services',
      url: "/services"
      templateUrl: "services.html"
    ).state('services.detail',
      url: "/detail/"
      templateUrl: "detail.html"
    )

in servicesCtrl :

$scope.services = getServices.query();
user3235881
  • 487
  • 2
  • 9
  • 24
  • Here's another similar question : http://stackoverflow.com/questions/27696612/how-do-i-share-scope-data-between-states-in-angularjs-ui-router ...should help. – activebiz Jun 19 '15 at 11:37
  • 1
    Use a service to share data between different controllers in your application. – Joao Leal Jun 19 '15 at 11:46

0 Answers0