Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS:ng在td内重复并过滤_Javascript_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Javascript AngularJS:ng在td内重复并过滤

Javascript AngularJS:ng在td内重复并过滤,javascript,angularjs,angularjs-ng-repeat,Javascript,Angularjs,Angularjs Ng Repeat,我的angular应用程序有一些问题。如果我尝试使用我的过滤器“formatPhone” myApp.filter('formatPhone',函数(){ 返回功能(电话){ 如果(!phone.length){ 返回“”; } var偏移=0; var分割=[]; 如果(phone.length==10){ 劈开。推(3,3,2,2); }else if(phone.length==7){ 推(0,3,2,2); }否则{ 推(0,2,2,2); } var frag=[]; 对于(变量i=0

我的angular应用程序有一些问题。如果我尝试使用我的过滤器“formatPhone”

myApp.filter('formatPhone',函数(){ 返回功能(电话){ 如果(!phone.length){ 返回“”; } var偏移=0; var分割=[]; 如果(phone.length==10){ 劈开。推(3,3,2,2); }else if(phone.length==7){ 推(0,3,2,2); }否则{ 推(0,2,2,2); } var frag=[]; 对于(变量i=0;i 为此:

<tr ng-repeat="member in userlist | orderBy: 'name && group'">
      <td>{{member.name}}</td>
      <td>{{member.group}}</td>
      <td>{{member.team}}</td>
      <td>{{member.post}}</td>
      <td>{{member.phones.cdma || member.phones.home}}</td>
      <td>{{member.phones.mob | formatPhone}}</td>
</tr>

{{member.name}
{{member.group}
{{成员.团队}
{{member.post}
{{member.phones.cdma | | member.phones.home}
{{member.phones.mob | formatPhone}
我在控制台日志(angular.min.js:84)中得到错误,它对对象“member”中的每个元素都重复,但“formatPhone”函数可以工作。我怎样才能修好它

upd:类错误

Error: [$interpolate:interr] http://errors.angularjs.org/1.2.9/$interpolate/interr?p0=%7B%7Bmember.phones.mob%20%7C%20formatPhone%7D%7D&p1=TypeError%3A%20phone%20is%20null F/<@http://localhost/vendors/angular.min.js:6 qd/this.$get</g/s@http://localhost/vendors/angular.min.js:74 Bd/this.$get</h.prototype.$digest@http://localhost/vendors/angular.min.js:100 Bd/this.$get</h.prototype.$apply@http://localhost/vendors/angular.min.js:103 Zb/c/<@http://localhost/vendors/angular.min.js:18 d@http://localhost/vendors/angular.min.js:30 Zb/c@http://localhost/vendors/angular.min.js:18 Zb@http://localhost/vendors/angular.min.js:18 Tc@http://localhost/vendors/angular.min.js:17 @http://localhost/vendors/angular.min.js:201 o.Callbacks/j@https://code.jquery.com/jquery-2.1.0.min.js:2 o.Callbacks/k.fireWith@https://code.jquery.com/jquery-2.1.0.min.js:2 .ready@https://code.jquery.com/jquery-2.1.0.min.js:2 r...

错误:[$interpolate:interr]http://errors.angularjs.org/1.2.9/$interpole/interr?p0=%7B%7B member.phones.mob%20%7C%20formatPhone%7D%7D&p1=TypeError%3A%20phone%20is%20null F/控制台中出现了什么错误?尝试使用angular.js而不是minified,以在开发时获得更好的错误。还有可能phones.mob未定义吗?您可能还需要在函数中检查
是否(!phone)
。哈桑,谢谢!我甚至没想过。它有助于:if(!phone | |!phone.length)
Error: [$interpolate:interr] http://errors.angularjs.org/1.2.9/$interpolate/interr?p0=%7B%7Bmember.phones.mob%20%7C%20formatPhone%7D%7D&p1=TypeError%3A%20phone%20is%20null F/<@http://localhost/vendors/angular.min.js:6 qd/this.$get</g/s@http://localhost/vendors/angular.min.js:74 Bd/this.$get</h.prototype.$digest@http://localhost/vendors/angular.min.js:100 Bd/this.$get</h.prototype.$apply@http://localhost/vendors/angular.min.js:103 Zb/c/<@http://localhost/vendors/angular.min.js:18 d@http://localhost/vendors/angular.min.js:30 Zb/c@http://localhost/vendors/angular.min.js:18 Zb@http://localhost/vendors/angular.min.js:18 Tc@http://localhost/vendors/angular.min.js:17 @http://localhost/vendors/angular.min.js:201 o.Callbacks/j@https://code.jquery.com/jquery-2.1.0.min.js:2 o.Callbacks/k.fireWith@https://code.jquery.com/jquery-2.1.0.min.js:2 .ready@https://code.jquery.com/jquery-2.1.0.min.js:2 r...