I have a problem with angular routing. I am trying to load the page through 
s-ref but it does not work, however if I specify through router it goes and 
open the page. Please help.

<a ui-sref="app.project.detail" class="btn btn-sm btn-success">Project 
title</a>


Router configuration

angular.module('app')
  .run(
    [          '$rootScope', '$state', '$stateParams',
      function ($rootScope,   $state,   $stateParams) {
          $rootScope.$state = $state;
          $rootScope.$stateParams = $stateParams;        
      }
    ]
  )

 // Research Project
              .state('app.project', {
                  abstract: true,
                  url: '/project',
                  templateUrl: 'tpl/project/research_list.html',
                  // use resolve to load other dependences
                  resolve: {
                      deps: ['uiLoad',
                        function( uiLoad ){
                          return uiLoad.load( ['js/app/project/project.js'] 
);
                      }]
                  }
              })
              .state('app.project.list', {
                  url: '/list',
                  templateUrl: 'tpl/project/research_list.html'
              })
              .state('app.project.detail', {
                  url: '/detail',
                  controller: 'ProjectCtrlNew',
                  templateUrl: 'tpl/project/research_detail.html'
              })
              .state('app.project.new', {
                  url: '/new',
                  templateUrl: 'tpl/project/research_detail.html'
              })
              .state('app.project.edit', {
                  url: '/edit/{project}',
                  templateUrl: 'tpl/project/research_detail.html'
              })

Project js controller
app.controller('ProjectCtrlList', ['$scope', '$http', '$stateParams', 
function($scope, $http,  $stateParams) {
$http.get('rest/research').then(function (resp) {
  $scope.projects = resp.data;
  }
);
}]);

app.controller('ProjectCtrlNew', ['$scope', function($scope) {
alert("hello");
}]);


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to