fix(forms): add support for reactive forms #402
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
is this compatible with angular 2.0 that was just officially released?
Works well in my project. Project uses angular@2.0.0.
How did you get it to work on 2.0.0? I get the following error, even though paths are correct:
This happened as soon as I updated. It was working on prior versions.
Edit: I just had another crack at this, and got it working. I had to change my system.config.js to the following:
and change my imports from:
import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload';to
import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload/ng2-file-upload';So, yes - it is supported!
can you show the code of the component and template?
I get the error uploader isn't a type of input
Hope this helps.
HTML Template:
Component (extracted only the relevant code):
Thanks @Davy-F
No problem, @hiddeb. Did you get it all working?
no is still get this error
`Unhandled Promise rejection:
Template parse errors:
Can't bind to 'uploader' since it isn't a known property of 'input'. (" document...
In your App,Module are you importing both FormsModule and ReactiveFormsModule?
yes FormsModule and ReactiveFormsModule are imported, but i still get the error
Hmm, could you post your code?
It seems valor are readying a new release rather soon so it might be worth holding out and trying that first.
Html template:
`
<div class="thumb document-border document-border-{{ document.status }}" *ngIf="document.file" [ngStyle]="{'background-image': 'url(' + document.file + ')'}">
Component:
`import {Component, OnInit, Input } from '@angular/core';
import { FileUploader, FileUploaderOptions } from 'ng2-file-upload/ng2-file-upload';
import { Document } from '../model/document';
@Component({
selector: 'kp-document',
templateUrl: 'app/document/document.component.html'
})
export class DocumentComponent implements OnInit {
@Input()
document: Document;
}`
Can you please assemble sample plunker or repo?
So I can fix it fast?
this is the plunker link: https://plnkr.co/edit/IcX2bS8VnasZHPIeNd9B
but i cant get it to work there
In your config.js you don't seem to be importing ng2-file-upload?
Also your app.ts will need to import FormsModule and ReactiveFormsModule as follows in this example:
Give those few things a go?
i get a different error,plunkr cant find document.ts.
But this is how we use it in our project
@hiddeb @Davy-F do you achieve this plnkr ? have you a valid plnkr for this component ng2-file-upload because my is still broken http://plnkr.co/edit/mjMCKvFV1m2tch2BxSl6?p=preview
did anyone get it working with angular2
I am getting error
Unexpected value 'FileUploader' imported by the module 'AppModule'