Who validates the property?

Issue I’m trying to find the piece of code that is responsible for property value validation. For example I have: <h1 [style.color]=”myColor”> And I bound myColor variable with input: <input (input)=”myColor = $event.target.value”> I expect change of color on input

Continue reading

Javascript to Angular 2 : document.querySelector('el').emit('em') to @viewChild

Issue How to convert HTML <a-entity id=”fading-cube” geometry=”primitive: box” material=”opacity: 1″> <a-animation attribute=”material.opacity” begin=”fade” to=”0″></a-animation> </a-entity> JS document.querySelector(‘#fading-cube’).emit(‘fade’); This is my code in Angular 2 that is not working. @ViewChild(‘fading-cube’) fadingCubeInput: any; fadecube(){ this.renderer.setProperty(this.fadingCubeInput.nativeElement,’emit’,”fade”) } Solution To access your element

Continue reading

Angular: How to use shared modules in a Dynamic Component?

Issue I’m creating dynamic component in Angular v6 using compileModuleAndAllComponentsAsync of angular compiler with same below code. viewChangeMethod(view: string) { let template = `<span>${view} </span>`; const tmpCmp = Component({ template: template })(class { }); this._compiler.clearCacheFor(this.tmpModule) this.tmpModule = NgModule({ declarations: [tmpCmp,FRAComponent],import:[ComonModule]

Continue reading

Angular: How to use shared modules in a Dynamic Component?

Issue I’m creating dynamic component in Angular v6 using compileModuleAndAllComponentsAsync of angular compiler with same below code. viewChangeMethod(view: string) { let template = `<span>${view} </span>`; const tmpCmp = Component({ template: template })(class { }); this._compiler.clearCacheFor(this.tmpModule) this.tmpModule = NgModule({ declarations: [tmpCmp,FRAComponent],import:[ComonModule]

Continue reading

Tooltip as dynamic component

Issue I want to add tooltip to the svg element, but as a component created dynamically. I add the tooltip to the element, using TooltipDirective on svg element i.e. <circle tooltip [hostContainerRef]=”chartContainerRef” [hostElement]=””>chartElement [data]=”d.tooltip”></circle> The TooltipDirective dyncamically creates TooltipComponent (in

Continue reading

Dynamically load nested components in angular?

Issue I want to organise my all tabs components dynamic components. I am using primg ng for ui tabs. Currently my code is allTabs.component.html Before <p-tabPanel header=”Contracts”> <app-a [arrId]=’parrangementId’ *ngIf=”tabIndex==1″></app-a> </p-tabPanel> <p-tabPanel header=”Allocations”> <app-b [arrId]=’parrangementId’ *ngIf=”tabIndex==2″></app-b> </p-tabPanel> </p-tabView> Here each

Continue reading

Inputs was not working by dynamic component

Issue I implemented with ndc-dynamic for creating dynamic component. It works very well with outputs, but inputs was not working. I will show my code. <ng-container *ngComponentOutlet=”item.widgetComponent; ndcDynamicInputs: inputs; ndcDynamicOutputs: outputs”> in the ts file aButtonDisabled: boolean; bButtonDisabled: boolean; inputs

Continue reading

Creating dynamic nested components from json response

Issue I’m trying to created nested dynamic components based on json response. public content={type:’paragraph’,depth:1,text:’Root’,entityRanges:[{type:’LINK’,offset:83,length:16,data:{target:’_self’,url:’/index.htm’}}],embbeded:[{type:’text’,text:’This is Text component’}]} So in the above structure, it as type paragraph so the ParagraphComponent need to render first. It as an array object embbeded, in

Continue reading

When is OnInit event triggered for a dynamically loaded angular component?

Issue I am dynamically loading an Angular component (MyComponent) with the following code. I am also passing some data to the component after creating it. let componentFactory = this.componentFactoryResolver.resolveComponentFactory(MyComponent); this.viewContainerRef.clear(); let componentRef = this.viewContainerRef.createComponent(componentFactory); (<MyComponent>componentRef.instance).setData(data); When will the OnInit lifecycle

Continue reading

Outputs on dynamic components without view

Issue On an Angular 8 project i created some dynmic components without a viewref with the following code: const componentFactory = this.componentFactoryResolver.resolveComponentFactory(HelloComponent); const componentRef = componentFactory.create(this.injector); componentRef.changeDetectorRef.detectChanges(); componentRef.instance.slideContentRendered.pipe(first()).subscribe(x => {console.log(‘does not work’, x);}); in the HelloComponent itself i’m waiting for

Continue reading

Dynamic Component Loading – get component as variable

Issue I’m implementing a relatively complex component loader in Angular, and I’d like to dynamically get the component instance from a rxjs store. loadEditAreaComponent(component: any, componentInstanceData?: {}){ const componentFactory = this.cfr.resolveComponentFactory(component); const viewContainerRef = this.editAreaHost.viewContainerRef; const componentRef = viewContainerRef.createComponent(componentFactory); Object.keys(componentInstanceData).forEach(key

Continue reading

How to create multiple instances of a dynamic component sequentially?

Issue I have a SystemMessageService which creates instances of SystemMessageComponent using the following method createSystemMessage(message: string, vcr: ViewContainerRef, time: number = 4500, isErrorMessage: boolean = false, isWarningMessage: boolean = false, isSuccessMessage: boolean = false){ let systemMessageCmpFactory = this.componentFactoryResolver.resolveComponentFactory(SystemMessageComponent); this.hostViewContainerRef =

Continue reading

How to create multiple instances of a dynamic component sequentially?

Issue I have a SystemMessageService which creates instances of SystemMessageComponent using the following method createSystemMessage(message: string, vcr: ViewContainerRef, time: number = 4500, isErrorMessage: boolean = false, isWarningMessage: boolean = false, isSuccessMessage: boolean = false){ let systemMessageCmpFactory = this.componentFactoryResolver.resolveComponentFactory(SystemMessageComponent); this.hostViewContainerRef =

Continue reading

How to create multiple instances of a dynamic component sequentially?

Issue I have a SystemMessageService which creates instances of SystemMessageComponent using the following method createSystemMessage(message: string, vcr: ViewContainerRef, time: number = 4500, isErrorMessage: boolean = false, isWarningMessage: boolean = false, isSuccessMessage: boolean = false){ let systemMessageCmpFactory = this.componentFactoryResolver.resolveComponentFactory(SystemMessageComponent); this.hostViewContainerRef =

Continue reading

How to wait for NgOnInit to complete inside Angular Dynamic Component?

Issue I am trying to set reactive form controls inside dynamic component from parent component. @ViewChild("priceSpecComp", { read: ViewContainerRef}) priceSpecComp: ViewContainerRef LoadDynamicComponent(variant, addons) { priceSpecComp.clear(); var comp = priceSpecComp.createComponent(PricingSpecDynamicComponent) comp.instance.setFormControls(variant, addons); } Inside PricingSpecDynamicComponent NgOnInit there is a http call

Continue reading

message: The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE

Issue So I have an API route Route::group([‘prefix’ => ‘users’], function() { Route::group([‘prefix’ => ‘seminar’], function() { Route::get(‘/{employee_number}’, [UserProfileController::class, ‘getSeminar’]); Route::post(‘/{user}’, [UserProfileController::class, ‘createSeminar’]); Route::put(‘/{seminar}’, [UserProfileController::class, ‘updateSeminar’]); Route::delete (‘/{seminar}’, [UserProfileController::class, ‘deleteSeminar’]); }); }); And a controller public function createSeminar(User $user, Request

Continue reading