发表于: 2017-06-17 21:10:57

1 1068


今天完成的事情:

怎么说呢,开启任务7,给我整蒙逼了。完全不知道自己在学什么,自己姓什么都不知道了。

给两个input添加了双向数据绑定,动态获取数据。

学习了$http的用法,但是我还没写出来,不知道怎么下手,现在还是没有写Angular的手感,找不到感觉。


明天计划的事情: 

继续啃任务7,一点点套轮子看看能不能实现。争取明天POST成功吧。

明天还要弄一波SVN


遇到的问题:

headers: 的Content-Type不会写。明天继续看看沁修姐姐的帖子再试试。

还有很多语法没弄明白,明天继续研究

收获:

套轮子套来的代码,还不是完全看得懂。

var app = angular.module("home");

    app.controller("personLogin", function($scope, $http, $state) {

    $scope.backLogin = function() {

        var a = $scope.username;

        var b = $scope.password;

        console.log(a, b);

        $http({

            method: "POST",

            url: "/carrots-admin-ajax/a/login",

            headers: {"Content-Type": "application/x-www-form-urlencoded"},

            params: {name:a, pwd: b}

        })

            .then(function(response) {

                console.log(response);

                if(response.data.code !== 0) {

                    $scope.tipsText = response.data.message;

                }

                else {

                    $state.go("main.welcome");

                }

            });

    };

});



返回列表 返回列表
评论

    分享到