Questions tagged [property-binding]

Property binding is the primary way of binding data in Angular. The square braces are used to bind data to a property of an element, the trick is to put the property onto the element wrapped in brackets: [property] .

Usage

  • This tag is intended for questions which ask about Angular Property Binding

Code Sample

Let's consider an example where we are binding the value property of the input element to a component's myText property.

import { Component } from "@angular/core";
@Component({
   selector: 'app-example',
   template: `
              <div>
              <h3 [value]='myText'></h3>       
              </div>
              `
})
export class AppComponent {
  myText: string = "Hello World";
}

Result:

Hello World


Asking a question

  • Mention you want to update/bind DOM elements to property in compoent.
  • Reduce your issue to a small example
  • Post a reduced working code on plnkr.co or stackblitz.com
  • If there's a bug (or some unintentional behavior), try to troubleshoot the problem. (If it's a bug report, please create a new issue at Angular's Github repository instead.)

Learn more

To learn more about Angular Material, visit the following resources to help you get started:

161 questions
2
votes
2 answers

@ConfigurationProperties Set

I'd like to have spring load some properties on startup and convert them into the proper types. application.yml: base: security: scopes: - name: read descripton: read some nice things - name: write description:…
Chris
  • 566
  • 1
  • 8
  • 20
2
votes
3 answers

Unable to pass styles to quill-editor component in angular

I'm trying to style a tag in app.component.html from app.component.ts but its not working.There are similar questions and articles but even the accepted answers ain't working for me. Here is my code. app.component.html
Tanzeel
  • 4,174
  • 13
  • 57
  • 110
2
votes
1 answer

SAPUI5 bind JSON Model consisting of objects to sap.m. Table

I have a problem binding my JSON Model to a sap.m.table. The model itself gets generated through an array which itself gets filled throughout the code and in the end it consists of different objects. Here's a screenshot of the object data: That…
sonja
  • 924
  • 1
  • 21
  • 52
2
votes
1 answer

How to use multiple ngFor on one directive for property binding

I'm using ng-drag and drop npm module which provides draggable directive. I also have a 2D array with list of items I want to display inside li elements and make each of them draggable. The thing is that I cannot use multiple ngFor's because that is…
Limpuls
  • 856
  • 1
  • 19
  • 37
2
votes
2 answers

Why would my Input Property Binding not work? - Angular

I am getting the property as undefined when attempting input property binding. Component with inputs: like.component.ts ` import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'like', templateUrl:…
2
votes
0 answers

@Input Angular undefined

I've got a tree of three components where i pass down the json data from backend using property binding altough it gets displayed i always get errors in the console that Cannot read property 'id' of null at ListCategoryComponent.ngOnInit I tried…
2
votes
1 answer

javafx imageview heightProperty binding don't work

i am facing problem to developed a demo JavaFX program for image viewing as a newbie. here i have an ImageView in BorderPane center position which is wrapped with a StackPane and VBox. where StackPane is always grow with VBox and i bind ImageView…
Rhidoy
  • 123
  • 1
  • 12
2
votes
1 answer

Can't bind to 'pickerType' since it isn't a known property of 'owl-date-time'

owl-date-time pickerType property is not not working with Angular 4. Can't bind to 'pickerType' since it isn't a known property of 'owl-date-time'. npm:…
Sreekanth Reddy
  • 483
  • 1
  • 6
  • 17
2
votes
1 answer

same property multiple values in NgStyle

I'm using Angular 4 and trying to bind styles to my html elements based on variables through ngStyle. However, with browser incompatibilities I ended up with this issue. How can I bind 3 different styles to the same css property without checking…
guarinex
  • 110
  • 1
  • 10
2
votes
0 answers

NullPointerException binding a Label's text to a TableView's selectedItemProperty

I'm curious if there is a way to bind a JavaFX Label's textProperty() to a TableViews's selectedItemProperty() without getting a NullPointerException when no entry is selected, which is for example during initialization. Here is a little snippet to…
Richard
  • 582
  • 5
  • 19
2
votes
0 answers

Angular2 - avoid side effects when property binding

We're supposedly not allowed to increment or set values in the property binding. In the official Angular2 docs, they claim that: The expression could call something like getFoo(). Only you know what getFoo() does. If getFoo() changes something and…
uglycode
  • 3,022
  • 6
  • 29
  • 55
2
votes
0 answers

Angular2: calling a local object function for img src

I have following template
The photos is coming as input to the template. The function…
Mayank
  • 5,454
  • 9
  • 37
  • 60
2
votes
2 answers

How to bind a property to a singleton object property from QML

There is a question about how to bind from a singleton object property to a QML property. But what about if we like to bind a QML property to a singleton object. Here is the singleton class definition, class Singleton : public QObject { …
cavitsinadogru
  • 940
  • 2
  • 10
  • 17
2
votes
1 answer

JavaFX 8 MapProperty unbind does not work?

Can anyone explain me if this is a bug or am I missing something in JavaFX MapProperty binding? Scenario: Two MapProperty instances - master and child. At first we bind child to master Then we store some values in master Unbind child from…
raivis
  • 53
  • 1
  • 5
1
vote
1 answer

SafeValue must use [property] getting appended to url in iframe src (Angular 14)

I am binding a link in iframe src as below public resultLink: SafeResourceUrl; …
Narasimhan
  • 73
  • 1
  • 7
1 2
3
10 11