$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-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...