Angular ui-router不更新视图

时间:2016-06-30 10:35:04

标签: angularjs angular-ui-router

我有以下代码:

var app = angular.module('app', ['ui.router', 'ui.router.title']);

app.config(function($stateProvider, $urlRouterProvider) {
  // For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/");
 //
 // Now set up the states
$stateProvider
.state('activity', {
  title: "activity",
  url: "/activity",
  templateUrl: "/app/activity",
  resolve: {
    $title: function() { return 'Home'; }
  }
})
.state('friends', {
  title: "Friends",
  url: "/friends",
  templateUrl: "/app/friends",
  resolve: {
    $title: function() { return 'Friends'; }
  }
})

});

<a ui-sref="activity" data-ui-sref-opts="{reload: true}" ui-sref-active="active">

然而,这里发生的事情是,当朋友们发生变化时,会发生变化。除非我自己手动刷新页面,否则它不会反映出来。

我已尝试data-ui-sref-opts="{reload: true}"之类的内容,但仍然无法完成工作。

0 个答案:

没有答案