diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 0b7f37d..ca5326e 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -14,7 +14,7 @@ import { OnInit } from '@angular/core'; templateUrl: './app.component.html', styleUrls: ['./app.component.css'], }) -export class AppComponent implements OnInit, ControlValueAccessor { +export class AppComponent implements OnInit { title = 'frontend'; projectComponents = []; chipsControl = new FormControl(''); @@ -27,13 +27,9 @@ export class AppComponent implements OnInit, ControlValueAccessor { hideRequiredControl = new FormControl(false); floatLabelControl = new FormControl('auto'); - //chips - @Input() opt: string[] = ["a","b"]; + @ViewChild('parent', { read: ViewContainerRef }) container: ViewContainerRef; - onChange!: (value: string[]) => void; - @ViewChild(MatChipList) - chipList!: MatChipList; - value: string[] = []; + constructor( fb: FormBuilder, @@ -45,40 +41,7 @@ export class AppComponent implements OnInit, ControlValueAccessor { floatLabel: this.floatLabelControl, }); } - registerOnChange(fn: (_: any) => void): void { - this.onChange = fn; - } - -propagateChange(value: string[]) { - if (this.onChange) { - this.onChange(value); - } -} -writeValue(value: string[]): void { - // When form value set when chips list initialized - if (this.chipList && value) { - this.selectChips(value); - } else if (value) { - // When chips not initialized - this.value = value; - } -}selectChips(value: string[]) { - this.chipList.chips.forEach((chip) => chip.deselect()); - - const chipsToSelect = this.chipList.chips.filter((c) => - value.includes(c.value) - ); - - chipsToSelect.forEach((chip) => chip.select()); - } - - registerOnTouched(fn: any): void { - throw new Error('Method not implemented.'); - } - setDisabledState?(isDisabled: boolean): void { - throw new Error('Method not implemented.'); - } - + getIfForwardLinkWorked() { return this.forwardLinkWorked; } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..c20304c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,24 @@ +{ + "name": "amos-ss2021-is-project-linter", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "chart.js": "^3.2.1" + } + }, + "node_modules/chart.js": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.2.1.tgz", + "integrity": "sha512-XsNDf3854RGZkLCt+5vWAXGAtUdKP2nhfikLGZqud6G4CvRE2ts64TIxTTfspOin2kEZvPgomE29E6oU02dYjQ==" + } + }, + "dependencies": { + "chart.js": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.2.1.tgz", + "integrity": "sha512-XsNDf3854RGZkLCt+5vWAXGAtUdKP2nhfikLGZqud6G4CvRE2ts64TIxTTfspOin2kEZvPgomE29E6oU02dYjQ==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fecf0b8 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "chart.js": "^3.2.1" + } +}