Does anyone have a *working *forms example? The few examples I see have
older syntax and none of them work in alpha33. They either don't compile or
throw exceptions. Even the source code comments in the alpha33 code has old
syntax that doesn't compile.
I am trying to create a simple form test that can validate a <input> text
field. Currently, I can't even get a form that doesn't throw an exception
on creation. Get the following exception:
EXCEPTION: Can't bind to 'controlGroup' since it isn't a known property of
the '<form>' element and there are no matching directives with a
corresponding property
angular2.dev.js:21831 STACKTRACE:
angular2.dev.js:21831 Error: Can't bind to 'controlGroup' since it isn't a
known property of the '<form>' element and there are no matching directives
with a corresponding property
at new BaseException
(http://localhost:8080/lb/spa/lib/angular2.dev.js:7738:25)
at http://localhost:8080/lb/spa/lib/angular2.dev.js:24336:15
at Map.forEach (native)
at Function.execute.MapWrapper.forEach
(http://localhost:8080/lb/spa/lib/angular2.dev.js:8285:15)
at buildElementPropertyBindings
(http://localhost:8080/lb/spa/lib/angular2.dev.js:24331:16)
at http://localhost:8080/lb/spa/lib/angular2.dev.js:24477:35
at Function.execute.ListWrapper.forEach
(http://localhost:8080/lb/spa/lib/angular2.dev.js:8400:15)
at ProtoViewBuilder.execute.ProtoViewBuilder.build
(http://localhost:8080/lb/spa/lib/angular2.dev.js:24447:25)
at $__1.execute.DomCompiler._compileView
(http://localhost:8080/lb/spa/lib/angular2.dev.js:29659:81)
at execute.DomCompiler.compile
(http://localhost:8080/lb/spa/lib/angular2.dev.js:29624:27)
AppCmpA2.ts:51 Application error: Can't bind to 'controlGroup' since it
isn't a known property of the '<form>' element and there are no matching
directives with a corresponding property(anonymous function) @
AppCmpA2.ts:51run @ angular2.dev.js:136zoneBoundFn @ angular2.dev.js:109run
@ angular2.dev.js:136zoneBoundFn @
angular2.dev.js:109lib$es6$promise$$internal$$tryCatch @
angular2.dev.js:1359lib$es6$promise$$internal$$invokeCallback @
angular2.dev.js:1371lib$es6$promise$$internal$$publish @
angular2.dev.js:1342lib$es6$promise$$internal$$publishRejection @
angular2.dev.js:1292(anonymous function) @
angular2.dev.js:187execute.NgZone._createInnerZone.zone.fork.fork.$scheduleMicrotask.microtask
@ angular2.dev.js:16054run @
angular2.dev.js:136execute.NgZone._createInnerZone.zone.fork.fork.$run @
angular2.dev.js:16029zoneBoundFn @
angular2.dev.js:109lib$es6$promise$asap$$flush @ angular2.dev.js:1153
<form #f [control-group]="echoStuff" (submit)="echoSubmit(f.value)">
<div>
Echo: <input control="echotext" required autofocus logger
#echo_input_ref type="text" placeholder="echo input"
/>
</div>
<button id="echoBtn" type="submit" class="btn btn-primary">Submit</button>
</form>
<div class="form-group">
<label id="echoResult">{{ echoResult }}</label>
</div>
///<reference path="../../../typings/abAppIncludes.d.ts" />
import {Component, View, formDirectives, FormBuilder, Validators, ControlGroup}
from "angular2/angular2";
import {AppCmpBaseA2} from "abweb2/ui/base/AppCmpBaseA2";
import {EchoService} from "service/echo/EchoService";
import {Logger} from "abweb2/ui/directives/Logger";
"use strict";
@Component({
selector: "echo"
})
@View({
templateUrl: "ui/echo/echoA2.html",
directives: [formDirectives]
})
export class EchoCmpA2 extends AppCmpBaseA2
{
/* tslint:disable:no-unused-variable */
private echoVal: string = "Hello World!";
/* tslint:enable:no-unused-variable */
private echoResult: string = "";
private echoStuff: ControlGroup;
constructor(private echoService: EchoService, builder: FormBuilder)
{
super();
this.echoStuff = builder.group(<any>{
echotext: ["hi there"]
});
}
public echoSubmit(echoInputVal: any)
{
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.