发表于: 2017-05-13 23:36:04
1 1050
今天完成的事情:
今天基本完成了任务8,包括type,status框搜索功能,使用原生type date制作日历,配合ng-disabled,判断语句,alert,ng-blur达到日期选择限制效果。但是在制作搜索日期功能时遇到了问题,导致搜索功能推倒重来。
明天的计划:彻底完成搜索功能,通过demo。
遇到的问题:
1 $stateParams的理解还是存在问题:
ui-router官方解释:
$stateParams Service
As you saw previously the $stateParams service is an object that will have one key per url parameter. The $stateParams is a perfect way to provide your controllers or other services with the individual parts of the navigated url.
Note: $stateParams service must be specified as a state controller, and it will be scoped so only the relevant parameters defined in that state are available on the service object.
// If you had a url on your state of:
url: '/users/:id/details/{type}/{repeat:[0-9]+}?from&to'
// Then you navigated your browser to:
'/users/123/details//0'
// Your $stateParams object would be
{ id:'123', type:'', repeat:'0' }
// Then you navigated your browser to:
'/users/123/details/default/0?from=there&to=here'
// Your $stateParams object would be
{ id:'123', type:'default', repeat:'0', from:'there', to:'here' }
$stateParams用于路由页面之间的导航,它可以根据你传入的相关参数改变页面的显示。
但是我自己在做搜索功能时,不知道如何将值传进$stateParams:
$scope.pageNum = $stateParams.page||'1';
$scope.pageSize = $stateParams.size||'10';
//
//
$scope.selType = $stateParams.type||'';
$scope.selStatus = $stateParams.status||'';
console.log('page的值',$scope.page);
console.log('$stateParams的值',$stateParams);
$stateParams的值 Object {page: "", size: ""}
前面两个传进去了,后面两个并没有传进去。
也做不到这样的效果:
http://dev.admin.carrots.ptteng.com/#/articleList/1/5?startAt=1494432000000&endAt=1494518399999
传给startAt=1494432000000&endAt=1494518399999值老是undefind。
对这个理解还是有蛮大问题的。
收获:
对angular的理解又深入了一点,只要参数涉及到页面之间的传递就要$scope,js文件内部参数就用传统的表示方式。
评论