相关疑难解决方法(0)

如何使用$ transition?

目前,我正在使用:

  • "angular-ui-router":"^ 0.4.2"
  • "棱角分明":"^ 1.6.3"
  • "webpack":"^ 2.4.1"

我知道我当前的实现可能已被弃用,只是寻找新方法的实现(示例或文档).非常感谢任何帮助,提前感谢!

目前的实施:

'use strict';

module.exports = angular
  .module('common', [
    'ui.router',
    'angular-loading-bar',
    require('./header').name,
    require('./sideBar').name,
    require('./footer').name
  ])
  .run(function($transitions, cfpLoadingBar) {
    $transitions.onStart({}, cfpLoadingBar.start);
    $transitions.onSuccess({}, cfpLoadingBar.complete);
  });
Run Code Online (Sandbox Code Playgroud)

当前错误:

未捕获错误:[$ injector:unpr]未知提供者:$ transitionsProvider < - $ transitions

javascript angularjs angular-ui-router webpack

12
推荐指数
1
解决办法
9378
查看次数

使用ui-router(AngularJS)时,$ rootScope.$ on("$ routeChangeSuccess"或$ rootScope.$ on("$ stateChangeSuccess")不起作用

我在我的应用程序中使用UI路由器来嵌套视图,但同时我想在路由更改时监听事件.在使用UI路由器之前,routeChangeSuccess正好点火但是在ui-router之后它不会触发.文档建议使用viewContedLoaded或stateChangeSuccess,但即使他们不被解雇.我正在粘贴我的代码片段.任何帮助,将不胜感激.

var app = angular.module('SmartKart', ['ngCookies','ngRoute','ui.bootstrap','angularPayments','ngAnimate','toaster','ui.router','LocalStorageModule']);
app.config(['$routeProvider','$httpProvider','$urlRouterProvider', '$stateProvider',  function($routeProvider, $httpProvider,$urlRouterProvider,$stateProvider) {
$routeProvider
//TODO: Clean-up...most of these routes can be eliminated since we are now using nested views inside main.html. should probably use .otherwise(... main.html) or something
  .when('/postal',
  {
    templateUrl: 'static/partials/landingPage.html',
    requireLogin: false
  })
  .when('/register',
  {
    templateUrl:'static/partials/landingPage.html',
    requireLogin: false
  })
  .when('/login',
  {
    templateUrl:'static/partials/landingPage.html',
    requireLogin: false
  })
  .when('/forgot',
  {
    templateUrl:'static/partials/landingPage.html',
    requireLogin: false
  })
  //TODO: Clean-up...most of these routes can be eliminated since we are now using nested views inside main.html
  .when('/noregister',
  { …
Run Code Online (Sandbox Code Playgroud)

angularjs angular-routing angular-ui-router

7
推荐指数
1
解决办法
4万
查看次数