Questions tagged [angular2-inputs]
32 questions
95
votes
4 answers
Update parent component property from child component in Angular 2
I'm using @input to receive a property from parent component in order to activate a CSS class in one of child component's element.
I'm able to receive the property from parent and also activate the class. But this works only once. The property i'm…

Body
- 3,608
- 8
- 42
- 50
23
votes
6 answers
@Input and other decorators and inheritance
I don't really understand how object binding works, so if anyone could explain if I can use @Input() inside a base class, or better: decorators and inheritance.
For example if each form should receive a customer I have a base class:
export class…

Silencer
- 1,602
- 4
- 17
- 27
15
votes
1 answer
Should Angular2 @Inputs be public or can/should we have a stricter API by making them private?
I am using Angular2 with Typescript
Suppose I have the following in my app component's template:
...

sixtyfootersdude
- 25,859
- 43
- 145
- 213
7
votes
2 answers
Angular 2 DI: pass input binding to deps of factory provider
Is there an easy way to inject an input binding into the deps array of a provider factory? Below obviously does not work.
const myServiceFactory = (object: any) => {
//...
};
@Component({
// ...
inputs: ['object'],
providers: [
…

Dominic
- 183
- 2
- 8
6
votes
1 answer
Angular2 ES6 @Input alternative
I'm trying to build a using ES6 syntax. The @Input syntax sugar isn't supported in ES6 and I can't find a viable alternative.
I'm defining the input in the parent with:
Then…

Evan Plaice
- 13,944
- 6
- 76
- 94
4
votes
1 answer
how to dynamically change the url in ng2-uploader
I am using ng2-uploader in my angular2 application.
Here is my code:
options: Object = {
url: "http://localhost/APP/opsnd/api/index.php/mydkd/configured/?"+JSON.stringify(this.type)
};
What I did in the above code is that I appended a…

valentine
- 457
- 8
- 17
3
votes
2 answers
Angular @Input is not working with bootstrap component
I did a mistake in my Angular2 class and I've not clearly understood about @Input.
I created 2 components AppComponent and AppDetailComponent.
In AppDetailComponent :
import { Component, Input } from '@angular/core';
@Component ({
selector:…

user2930562
- 33
- 4
3
votes
2 answers
Uncaught Reference Input is not defined- @Input() not working in Angular 2
I am a newbie trying to learn Angular2 from ng-book 2(v49). Here are the contents of article.componenets.ts file:
import { Component, OnInit } from '@angular/core';
import { Article } from './article.model';
@Component({
selector: 'app-article',
…

Saadat Rizvi
- 69
- 1
- 10
2
votes
1 answer
Two way data binding between multiple components in angular2?
I have two components HomePageComponent and StudentResultsComponent. I have an input in HomePageComponent that when I type, I want the value to be in my StudentResultsComponent input.
I thought of creating a separate component for the input and…

DingDong
- 367
- 3
- 12
- 22
2
votes
1 answer
angular2 - reference template reference variable in component to change value property
How do I access the value property of an element in the component in Angular2?
In the Template:
In the Component code:
import {ElementRef} from '@angular/core';
...
onInput(latLngInputElement:…

JohnV
- 31
- 1
- 4
2
votes
1 answer
@Input not receiving data from parent component
I just started working with the @Input feature of Angular and everything has been good so far up until this point. I'm using Firebase as my database and the chunk of data I'm calling in looks like this
{
"page_area_business_image" : {
…

Optiq
- 2,835
- 4
- 33
- 68
2
votes
1 answer
Angular 2 - change neighbor input variable on input variable change
I want to perform some operations when input parameters are being changed. Lets say I have a DatePicker component that has a type input variable, and I want to perform some actions with another date variable when type is being changed. How to do…

pleerock
- 18,322
- 16
- 103
- 128
1
vote
1 answer
@HostBinding initial @Input value ignored
I have a directive that helps with adding toggle effects to various elements.
export class AlloyToggleDirective {
private toggled = false;
@Input('alloyToggled')
@HostBinding('class.alloy-toggled')
get isToggled() { return…

Anthony
- 7,638
- 3
- 38
- 71
1
vote
0 answers
Angular2 Bootstrap component with input values
How can I pass input values to a component that needs to be bootstrapped in angular2
At the time of bootstrap, how can I pass some value to sampleInput?
@NgModule({
declarations: [SampleComponent],
imports : [],
exports : [],
…

sudharsan tk
- 494
- 6
- 14
1
vote
1 answer
Angular 2 Checkbox Validations Class
I have an checkbox input type inside of a formGroup with Validators.required set. The problem is when i make a click on the checkbox validations class ng-untouched is not changint into ng-touched. How can i fix this problem ?
Thank's

Bogdan Crișu
- 53
- 1
- 1
- 9