Use this tag for questions regarding creating a custom component in Angular 2.
Questions tagged [angular2-custom-component]
15 questions
21
votes
1 answer
Angular: How to have @Input setters called in certain order?
I'm creating a component. Since I like the Apache Wicket way of doing things, I am trying to emulate the IModel way of passing data. For that, to the child component I pass a model and callbacks which can pull out the relevant values, instead of…

Ondra Žižka
- 43,948
- 41
- 217
- 277
6
votes
4 answers
Why click function triggers twice for custom component in Angular 2
My custom component click function is triggered twice - both custom component's event and sample level event are triggered.
Here's my Plunker:
https://plnkr.co/edit/wp2iWh7OStdPm5uXsWbP?p=preview

Abinaya
- 364
- 2
- 6
- 16
4
votes
2 answers
Angular doesnt work on lazy-loaded modules
I have created a custom component which works fine on app.component, but when the is used in lazy loaded module it gives an error:
Error: Template parse errors:
'my-component' is not a known element:
1. If 'my-component' is an…

Hese
- 291
- 5
- 18
3
votes
0 answers
Scripts.js and styles.js file do not get generated
I tried following tutorial to generate my first own custom component / web component in Angular: https://indepth.dev/posts/1116/angular-web-components-a-complete-guide
It's from 2020, so it should be relatively up to date. I also tried other tuts,…

Boommeister
- 1,591
- 2
- 15
- 54
3
votes
2 answers
How to handle input events on custom input component in Angular?
I'm trying to create a custom Input component using Reative Form in Angular 7 but i'm having trouble passing events to the input field.
My component has a label and an input field and a specific layout. My component html looks like this:

Mateus Borges
- 53
- 1
- 6
3
votes
3 answers
Angular 2 Custom Form Component: Provide a markTouched method
I have a custom form component that implements ControlValueAccessor. This component has an internal property touched.
export class BmInputComponent implements ControlValueAccessor, Validator {
private onTouchedCallback: () => {};
private…

Zucca
- 561
- 1
- 7
- 21
2
votes
1 answer
Error encountered resolving symbol values statically. Calling function 'CreateCustomComponent', function calls are not supported
I am getting below error when creating my custom component.
Error encountered resolving symbol values statically. Calling function 'CreateCustomComponent', function calls are not supporte
d. Consider replacing the function or lambda with a…

Abinaya
- 364
- 2
- 6
- 16
1
vote
1 answer
Multiple @Input in Ionic 3 and Angular 2
In my Ionic 3 project, I have created custom component my-component.
Now as we know using angular @Input we can pass data to this component.
I have 2 inputs as
@Input('finder') myFinder: Finder; //Finder is an Interface
@Input('list') myList:…

Tapas Mukherjee
- 2,088
- 1
- 27
- 66
0
votes
4 answers
Binding custom class inside ngClass in Angular
I am trying to bind a class name inside Angular ngClass so that the user will be able to set any class name he likes to the element.
I have the following in my js file and would like to assign this class name to the div element if this.customClass…

Sha
- 1,826
- 5
- 29
- 53
0
votes
1 answer
Get custom component reference in angular?
I am having custom component like below. and i want to get id of component that we used in html file.
@Directive({
selector: `[myattr]`
})
export class myclass
{
// want to get reference where myattr defined
//#myid
}
in html i will…

Kbvin
- 216
- 3
- 13
0
votes
1 answer
How to use Custom style component for tags background color in ng2-tag-input?
How can I add background color to tags in ng2-tag-input plugin,I searched it ,they said that we need to use custom component for styles,I added but getting trigger is not found,i am using this https://github.com/Gbuomprisco/ng2-tag-input website.can…

Sathish Kotha
- 1,081
- 3
- 17
- 30
0
votes
0 answers
Define complex property with custom tag?
Is this possible to pass complex property with custom elemment as follow.
customcomponent.ts
import { Component, forwardRef,Input } from '@angular/core';
@Component({
selector: 'custom-div',
template: `
Custom Div…

Abinaya
- 364
- 2
- 6
- 16
0
votes
0 answers
Using complex property with custom component?
If i pass complex inputs (prop.childprop) as string getting error "Cannot read property 'property' of undefined"
export function NewComponent(name:string, componentArgs: {
selector: string,
inputs: Array
}): Type {
var comp =…

Abinaya
- 364
- 2
- 6
- 16
0
votes
0 answers
Angular2 href issue for carousel next slide
I have a custom modal component which is responsible to display overlay(modal-popup) which contains carousel.
Problem : As you can see in below code, outer div contains (click) event to close the overlay (I dont have Header part in overlay).

micronyks
- 54,797
- 15
- 112
- 146
-2
votes
1 answer
Search filter in custom list component
I am creating a custom list component with a search in my angular project. This component will take itemList as input and list the items based on the same. I would like to plug in a search bar to this component so that the user can search the items…

Sha
- 1,826
- 5
- 29
- 53