Guest User

Untitled

a guest
Jan 29th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. <div class="form-group" ng-repeat="(key,value) in providerList" ng-if="!$first">
  2. <label>{{key.replace("_", " ") | uppercase}}</label>
  3. <div ng-if="providerList[key].length > 100">
  4. <textarea class="form-control" ng-model="providerList[key]"></textarea>
  5. </div>
  6. <div ng-if="providerList[key].length < 100 && !isNumeric(providerList[key]) && !checkEmail(providerList[key])">
  7. <input type="text" class="form-control" id='datepicker' ng-model="providerList[key]">
  8. </div>
  9.  
  10. <div ng-if="isNumeric(providerList[key])">
  11. <input type="number" class="form-control" ng-model="providerList[key]">
  12. </div>
  13.  
  14. <div ng-if="checkEmail(providerList[key])">
  15. <input type="email" class="form-control" ng-model="providerList[key]">
  16. </div>
  17. </div>
  18.  
  19. $scope.isNumeric = function (data) {
  20.  
  21. if (isNaN(data)) {
  22. return false;
  23. } else {
  24. return true;
  25. }
  26.  
  27. // if (/^d+$/.test(data)) {
  28. // return true;
  29. // } else {
  30. // return false;
  31. // }
  32. };
  33.  
  34. $scope.checkEmail = function (email) {
  35. var re = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
  36. return re.test(email);
  37. };
  38.  
  39. Error: [ngModel:numfmt] Expected `1` to be a number
  40. http://errors.angularjs.org/1.4.8/ngModel/numfmt?p0=1
  41. minErr/<@http://localhost:1000/js/vendor/angular/angular.js:68:12
  42. numberInputType/<@http://localhost:1000/js/vendor/angular/angular.js:21977:1
  43. ngModelWatch@http://localhost:1000/js/vendor/angular/angular.js:25489:21
  44. $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:1000/js/vendor/angular/angular.js:15888:34
  45. $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:1000/js/vendor/angular/angular.js:16160:13
  46. done@http://localhost:1000/js/vendor/angular/angular.js:10589:36
  47. completeRequest@http://localhost:1000/js/vendor/angular/angular.js:10787:7
  48. requestLoaded@http://localhost:1000/js/vendor/angular/angular.js:10728:1
  49.  
  50.  
  51. return logFn.apply(console, args);
  52.  
  53. angular.js (line 12520)
  54. Error: [ngModel:numfmt] Expected `1234567890` to be a number
  55. http://errors.angularjs.org/1.4.8/ngModel/numfmt?p0=1234567890
  56. minErr/<@http://localhost:1000/js/vendor/angular/angular.js:68:12
  57. numberInputType/<@http://localhost:1000/js/vendor/angular/angular.js:21977:1
  58. ngModelWatch@http://localhost:1000/js/vendor/angular/angular.js:25489:21
  59. $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:1000/js/vendor/angular/angular.js:15888:34
  60. $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:1000/js/vendor/angular/angular.js:16160:13
  61. done@http://localhost:1000/js/vendor/angular/angular.js:10589:36
  62. completeRequest@http://localhost:1000/js/vendor/angular/angular.js:10787:7
  63.  
  64. angular.module('numfmt-error-module', [])
  65.  
  66. .run(function($rootScope) {
  67. $rootScope.typeOf = function(value) {
  68. return typeof value;
  69. };
  70. })
  71.  
  72. .directive('stringToNumber', function() {
  73. return {
  74. require: 'ngModel',
  75. link: function(scope, element, attrs, ngModel) {
  76. ngModel.$parsers.push(function(value) {
  77. return '' + value;
  78. });
  79. ngModel.$formatters.push(function(value) {
  80. return parseFloat(value);
  81. });
  82. }
  83. };
  84. });
Add Comment
Please, Sign In to add comment