Questions tagged [angular-components]

A component controls a patch of screen called a view. Component decorator allows you to mark a class as an Angular component and provide additional metadata that determines how the component should be processed, instantiated and used at run time.

Components are the most basic building block of an UI in an Angular application. An Angular application is a tree of Angular components. Angular components are a subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template.You can see more information on components here

2024 questions
8
votes
2 answers

Angular2: How to show inner HTML of component-tags inside of component?

I have a question for angular2. I'm creating some components and want to have something like this: This is my DogComponent class: @Component({ selector: "dog", template: "dog.template.html" }) class DogComponent { @Input() image:…
be-ndee
  • 1,153
  • 3
  • 13
  • 19
8
votes
2 answers

Can I reuse components across apps?

I am new to Angular2 and I am interested in finding out if there is a possibility of reusing entire sets of presentation components from within one application in another application? For example I have an Angular 2 application called MyApp and in…
Donal Rafferty
  • 19,707
  • 39
  • 114
  • 191
7
votes
4 answers

Conditional button color attr in Angular Material (Components)

I have a component that takes an Input.. @Input() coDeliveryCandidates: DeliverySlotView[]; this is used in the template:
7
votes
2 answers

In Angular, how do I insert specific component instances without using directives/templates?

So, let's say I have a component, ExampleComponent, that builds a QueryList of SomeOtherComponent components in its content view. import {Component, ContentChildren, QueryList} from '@angular/core' import {SomeOtherComponent} from…
user6516765
7
votes
4 answers

How can I destroy an Angular component?

I'm making a modal and I made it a component . Inside I have a close button. I want to destroy when I click that button. Something like this: I also…
akko
  • 559
  • 3
  • 8
  • 17
7
votes
3 answers

AGM angular Google Maps Set Zoom programmatically

I am working with AGM (Angular Google Maps) and OpenLayers. I need to set the zoom of my AGM programmaticly but haven't been able to figure out how it works. HTML Maps...
7
votes
2 answers

Angular 7: "Cannot find control with unspecified name attribute"

I am creating my first Angular app and I am getting the following errors in dev mode console: ERROR Error: "Cannot find control with unspecified name attribute" ERROR Error: "Cannot find control with path: 'items -> name'" ERROR Error: "Cannot find…
7
votes
2 answers

How to define a component class as an interface field in Typescript?

I have the following interface: interface Drawer { title: string, content: Component } Afterwards I instantiate this interface: let workspace: Drawer = { title: 'Workspaces', content: SidebarWorkspacesComponent }; During compilation I…
Chololoco
  • 3,140
  • 1
  • 21
  • 24
7
votes
1 answer

How to remove a component dynamically in angular

I went through angular dynamically loading components. But i could not find how to remove the component dynamically. My requirement is that the chat application loads dynamic component(image/graph/list/table) as per the conversation. But how can i…
7
votes
4 answers

Create an Angular component to display a set of html table cells to embed in other tables

I have a lot of html tables that share the same 15 columns along with custom columns that are specific for each table. I would like to create these common 15 columns as a component that takes in a set of data and shows up as the 15 td's without a…
Jeremy
  • 1,023
  • 3
  • 18
  • 33
7
votes
4 answers

How do I reference an Angular component from typescript when it may be removed by ngIf?

I have a template which uses MatInput from Angular Material. I am trying to access this component from code using @ViewChild so I can programmatically alter the focused state, but this MatInput is not there when the view initializes - its presence…
Seth
  • 342
  • 1
  • 4
  • 14
7
votes
2 answers

is not getting filled

I am a beginner with Angular 2 and have started with a small project consisting of these files: app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { MaterialModule } from…
fusionlightcat
  • 365
  • 1
  • 5
  • 20
7
votes
1 answer

Angular exported component from module not useable in another module

I am exporting a custom component in my AppModule but can not use it in another module, which is being imported in the AppModule. I thought exported components are visible globally? I am trying to use the CalendarComponent with the selector…
user3740359
  • 395
  • 1
  • 6
  • 16
7
votes
1 answer

Changing App Layout Drawer persistent to temporary at media change in AngularDart

I have an App Layout of angular components in my AngularDart project. How can I change the drawer of App layout from persistent to temporary at the change of media screen?
Tushar Rai
  • 2,371
  • 4
  • 28
  • 57
7
votes
1 answer

Angular 2: Load different versions of the libraries based on the data

I have a requirement where I need to load different version modules based on the data. Something like monthly data, if some change happens in my module code for the current month, there shouldn't be any change in the view/logic from the previous…