$scope.searchMsg={
empName:$scope.search.name,
empNum:$scope.search.num,
startTime:$scope.search.startTimeValue,
endTime:$scope.search.endTimeValue
}
后边的$scope.search是一段封装的指令,大概类似这样
function lmInput_name() {
return {
restrict: 'E',
scope: false,
templateUrl: 'components/directiveTmp/lmInput_name.html',
controller: function ($scope) {
}
}
}
下面是lmINput_name.html
前面的$scope.searchMsg每次的属性可能不一样。
第一种:
想问的是有什么更好的方法给$scope.searchMsg赋值,看起来更优雅。
第二种:
或者可以提供一个方法在
能做到第二种更好,初学者,望指教。
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证高级PHP讲师