Я сталкиваюсь с проблемой примерно так: если 'runningStatus' является вводом директивы, убедитесь, что директива импортирована текущим модулем. ("contact" role = "tabpanel" aria-labelledby = "pills-contact-tab">] [продолжаетсяStatus] = "projects"> Привязка к свойству события .. Если 'runningStatus' является входом директивы, убедитесь, что директива импортирована текущим модулем. ("Contact" role = "tabpanel" aria-labelledby = "pills-contact-tab">
Failed : Ошибки синтаксического анализа шаблона: Привязка к свойству события 'comingStatus' запрещена по соображениям безопасности, пожалуйста, используйте (goingStatus) = ... Если 'runningStatus' является входом директивы, убедитесь, что директива импортирована текущим модулем. ("Contact "role =" tabpanel "aria-labelledby =" pills-contact-tab ">] [продолжаетсяStatus] =" проекты ">
projects.spe c .ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA ,CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import { AllProjectsComponent } from './all-projects.component';
import { RouterTestingModule } from '@angular/router/testing';
import { ProjectsService } from './../../../../services/projects/projects.service';
import { GooglePlaceModule } from 'ngx-google-places-autocomplete';
import { ProjectObject } from './../../../../models/project.model';
import { MockProjectService } from './../../../../mock/mockProject.service';
describe('AllProjectsComponent', () => {
let component: AllProjectsComponent;
let fixture: ComponentFixture<AllProjectsComponent>;
let service : ProjectsService;
let response;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AllProjectsComponent ],
imports: [ RouterTestingModule, GooglePlaceModule ],
providers: [
{
provide: ProjectsService,
useClass: MockProjectService
},],
schemas: [ NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AllProjectsComponent);
component = fixture.componentInstance;
service = TestBed.get(ProjectsService);
response = {
project: {
projectType : "public",
status : "open",
}
} as ProjectObject
fixture.detectChanges();
});
it('', () => {
component.ngOnInit();
expect(service.getAllprojects()).toBe(response);
})
project.component. html
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">
<app-ongoing-projects [ongoingStatus]="projects "></app-ongoing-projects>
</div>
project.component.ts
import { ProjectObject } from './../../../../models/project.model';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ProjectsService } from './../../../../services/projects/projects.service';
import { GooglePlaceDirective } from 'ngx-google-places-autocomplete';
import { Address } from 'ngx-google-places-autocomplete/objects/address';
@Component({
selector: 'app-all-projects',
templateUrl: './all-projects.component.html',
styleUrls: ['./all-projects.component.scss']
})
export class AllProjectsComponent implements OnInit {
// public projects;
public projects: ProjectObject[];
@ViewChild('placesRef', { static: false }) placesRef: GooglePlaceDirective;
public option = {
types: ['(cities)'],
componentRestrictions: { country: 'IN' }
};
public location: string;
public licenseType: string;
public resetBtn = false;
public loading = true;
validdata: boolean;
constructor( private projectsService: ProjectsService) { }
ngOnInit(): void {
this.projectsService.getAllprojects().subscribe((data) => {
console.log(data);
this.projects = data;
this.loading = false;
if (!this.projects['0']) {
this.validdata = true;
}
});
}
public handleAddressChange(address: Address) {
this.location = address.formatted_address;
console.log(address)
}
}