Skip to main content
Commonmark migration
Source Link

I have the following code snippets

##.html <input type = "number" min = "0" max = "120" #yearsCtrl = "ngForm" [ngFormControl] = "ageForm.controls['yearsCtrl']" [(ngModel)] = "age.years" id = "years">

.html

##.dart

 <input type = "number" min = "0" max = "120" #yearsCtrl = "ngForm" [ngFormControl] = "ageForm.controls['yearsCtrl']" [(ngModel)] = "age.years" id = "years"> 

.dart

class Age { int years = 0; } class AgeComponent { .... AgeComponent( FormBuilder fb, ModelService ageSrvc) { ageForm = fb.group( { 'yearsCtrl': [''], } ); _yearsCtrl = ageForm.controls['yearsCtrl']; age = new Age() } ... } 

My attempts to run the application gives the following errors (partial)

>EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] (anonymous function) ORIGINAL EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. (anonymous function) ORIGINAL STACKTRACE: (anonymous function) #0 NumberValueAccessor.writeValue (package:angular2/src/common/forms/directives/number_value_accessor.dart:38:23) #1 setUpControl (package:angular2/src/common/forms/directives/shared.dart:34:21) #2 NgFormControl.ngOnChanges (package:angular2/src/common/forms/directives/ng_form_control.dart:111:7) ... 

It seems as if the type="num" is not being handled. I suspect the age int might be an issue also, in that it is an int but a string is required. The reverse conversion from sting back to int might also be an issue.

Any help is appreciated.

Thanks

I have the following code snippets

##.html <input type = "number" min = "0" max = "120" #yearsCtrl = "ngForm" [ngFormControl] = "ageForm.controls['yearsCtrl']" [(ngModel)] = "age.years" id = "years">

##.dart

class Age { int years = 0; } class AgeComponent { .... AgeComponent( FormBuilder fb, ModelService ageSrvc) { ageForm = fb.group( { 'yearsCtrl': [''], } ); _yearsCtrl = ageForm.controls['yearsCtrl']; age = new Age() } ... } 

My attempts to run the application gives the following errors (partial)

>EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] (anonymous function) ORIGINAL EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. (anonymous function) ORIGINAL STACKTRACE: (anonymous function) #0 NumberValueAccessor.writeValue (package:angular2/src/common/forms/directives/number_value_accessor.dart:38:23) #1 setUpControl (package:angular2/src/common/forms/directives/shared.dart:34:21) #2 NgFormControl.ngOnChanges (package:angular2/src/common/forms/directives/ng_form_control.dart:111:7) ... 

It seems as if the type="num" is not being handled. I suspect the age int might be an issue also, in that it is an int but a string is required. The reverse conversion from sting back to int might also be an issue.

Any help is appreciated.

Thanks

I have the following code snippets

.html

 <input type = "number" min = "0" max = "120" #yearsCtrl = "ngForm" [ngFormControl] = "ageForm.controls['yearsCtrl']" [(ngModel)] = "age.years" id = "years"> 

.dart

class Age { int years = 0; } class AgeComponent { .... AgeComponent( FormBuilder fb, ModelService ageSrvc) { ageForm = fb.group( { 'yearsCtrl': [''], } ); _yearsCtrl = ageForm.controls['yearsCtrl']; age = new Age() } ... } 

My attempts to run the application gives the following errors (partial)

>EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] (anonymous function) ORIGINAL EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. (anonymous function) ORIGINAL STACKTRACE: (anonymous function) #0 NumberValueAccessor.writeValue (package:angular2/src/common/forms/directives/number_value_accessor.dart:38:23) #1 setUpControl (package:angular2/src/common/forms/directives/shared.dart:34:21) #2 NgFormControl.ngOnChanges (package:angular2/src/common/forms/directives/ng_form_control.dart:111:7) ... 

It seems as if the type="num" is not being handled. I suspect the age int might be an issue also, in that it is an int but a string is required. The reverse conversion from sting back to int might also be an issue.

Any help is appreciated.

Thanks

edited title
Link
st_clair_clarke
  • 5.7k
  • 13
  • 53
  • 75

<input type="num">type="number"> generating errors

Source Link
st_clair_clarke
  • 5.7k
  • 13
  • 53
  • 75

<input type="num"> generating errors

I have the following code snippets

##.html <input type = "number" min = "0" max = "120" #yearsCtrl = "ngForm" [ngFormControl] = "ageForm.controls['yearsCtrl']" [(ngModel)] = "age.years" id = "years">

##.dart

class Age { int years = 0; } class AgeComponent { .... AgeComponent( FormBuilder fb, ModelService ageSrvc) { ageForm = fb.group( { 'yearsCtrl': [''], } ); _yearsCtrl = ageForm.controls['yearsCtrl']; age = new Age() } ... } 

My attempts to run the application gives the following errors (partial)

>EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. in [AST] (anonymous function) ORIGINAL EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'. (anonymous function) ORIGINAL STACKTRACE: (anonymous function) #0 NumberValueAccessor.writeValue (package:angular2/src/common/forms/directives/number_value_accessor.dart:38:23) #1 setUpControl (package:angular2/src/common/forms/directives/shared.dart:34:21) #2 NgFormControl.ngOnChanges (package:angular2/src/common/forms/directives/ng_form_control.dart:111:7) ... 

It seems as if the type="num" is not being handled. I suspect the age int might be an issue also, in that it is an int but a string is required. The reverse conversion from sting back to int might also be an issue.

Any help is appreciated.

Thanks