发表于: 2017-07-12 23:07:30

1 978


一、今天完成的事:

1.重写任务中http请求部分,将ng-modle绑定饿数据直接更改为对象的属性,直接在http请求中将绑定的数据赋值给params;

2.学习ng-click和$state.go传参,点击搜索的时候将数据传到url里面,防止页面刷新的时候数据丢失;

二、明天的计划:

1.实现ng-click和$state.go传参还有点问题,会导致页面加载两次,明天解决

三、遇到的问题:

1.实现ng-click和$state.go传参还有点问题,请求发送正常,但是列表页无法加载,需要在研究一下

四、收获:

1、将搜索框中 的数据都用ng-modle绑定为一个对象的属性,直接将该对象赋值给http请求中params,减少代码量;

$http({
method: 'get',
   url: '/carrots-admin-ajax/a/article/search',
   params : $scope.params

2、绑定input设置的时间的话,还需要将时间格式转化为时间戳,并在之后将时间戳改成时间格式,这样才能正常显示;

$scope.params.startAt = Date.parse($scope.startAt);
$scope.params.endAt = Date.parse($scope.endAt);
$scope.startAt = new Date($scope.params.startAt);
$scope.endAt = new Date($scope.params.endAt);

3、$state.go传参,将搜索内容传给url

$state.go('home.Article',{type:$scope.params.type},{reload: true});
.state("home.Article", {
url:"/Article/?type",
   templateUrl: "html/Article.html",
   controller: "articleCtrl"



返回列表 返回列表
评论

    分享到