发表于: 2017-06-10 23:17:18

0 672


今天做了啥:

懒加载模块老是出问题。调试了好久。

又发现了我以前的一个误区。之前登陆页面是密码核实正确后直接跳转页面。。但其实并不是这样的

oginService.login(params).then(function (res) {

            if (res.data.code == 0) {

                $cookies.login = "true";

                $state.go("field.dashboard");

                recordCookies({managerID: res.data.data.manager.id, roleID: res.data.data.manager.roleID});

                managerService.saveSelfDetail(res.data.data);

            } else {

                vm.errorTip = res.data.message;

                $timeout(function () {

                    vm.errorTip = "";

                }, 3000);

            }

        });

    };

而是用$state.go进行跳转。

ui-sref、$state.go 的区别:

ui-sref 一般使用在 <a>...</a>;

<a ui-sref="message-list">消息中心</a>

$state.go('someState')一般使用在 controller里面;

.controller('firstCtrl', function($scope, $state) {

      $state.go('login');

 });

这两个本质上是一样的东西:

element.bind("click", function(e) {

    var button = e.which || e.button;

    if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {

      var transition = $timeout(function() {

        // HERE we call $state.go inside of ui-sref

        $state.go(ref.state, params, options);

      });

ui-sref最后调用的还是$state.go()方法

并且这里就开始用params服务了。

今天做啥。继续复盘呗。问题好多只能慢慢的解决。


返回列表 返回列表
评论

    分享到