Questions tagged [angular2-template]

For questions referencing Angular Template Syntax including: interpolation, input(property) bindings, output(event) bindings, two-way binding, local variables, star syntax, etc. This tag is specific to angular version 2.x and above

Tag content based loosely off Victor Savkin's Angular Template Syntax article

2881 questions
1
vote
1 answer

Using string interpolation inside an external template resource

I'm refactoring an Angular 2 component that does some template nesting. The original code was something like this: (component.ts) let subItemTemplate = require('./sub-item-template.html'); @Component({ selector: 'my-component', template: `
Stefan Mohr
  • 2,170
  • 2
  • 23
  • 35
1
vote
1 answer

How to use router-outlet from lazy loaded children module inside primary router-outlet

as i said here i'm developing an Angular2 app with the following project structure: I have a primary router-outlet inside "main" component and another router-outlet inside "first" component. Here is the template of the main component:
smartmouse
  • 13,912
  • 34
  • 100
  • 166
1
vote
1 answer

angular 2 data binding template for @input

I'm curious to know how you guys would convert binding a data input from template: `` to doing something like this let data = new PercentValue(20, 100); let guageBar = new GuageBar(this.data,'Database…
Alex Tang
  • 83
  • 5
1
vote
1 answer

What is the uses of angular2 Polyfill js file

Which configuration files are need to integrate angular2 application.
Moses bendicion
  • 107
  • 3
  • 7
1
vote
2 answers

Cannot bind json data to view Angularjs2

I'm trying to bind json data to template, but I keep getting some exceptions. Here's my code: account.ts export interface Account{ AccountType:string; AmountHeld:string; AvailableBalance:string; } account.service.ts import {…
Isuru
  • 950
  • 1
  • 13
  • 34
1
vote
1 answer

Update template with received data

I've managed to retrieve a set of data from a post request, but now the view does not update when I assign it. @Component({ selector: 'news-section', templateUrl: './news-section.component.html', styleUrls: ['./news-section.component.scss'], …
mjanisz1
  • 1,478
  • 3
  • 17
  • 43
1
vote
2 answers

Angular2 how to pass data throught router

I'm devolping a web application using Angular v2.0.0. Since I have a sub-navigation in my app I would like to pass some data to a sub-page, that loads its own component, through the . As i can see on Angular2 documentation I can reach…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
1
vote
2 answers

HTML Loop with If Statement

I am using Ionic2/Angular2. I have a collection of messages which I loop through and display their details.
Richard
  • 8,193
  • 28
  • 107
  • 228
1
vote
1 answer

ngClass in Angular 2 not rendering in table

I currently have a in my template and need to apply styling in different parts (row, cell), I'm reading from a css file. Everything was working fine when I only used the file style for styling the
elements, now I wanted to incorporate…
joeCarpenter
  • 1,495
  • 4
  • 19
  • 32
1
vote
1 answer

Expose object function to data binding in Typescript Ionic

How can one call a function on a Typescript model object in an Ionic HTML template? When I attempt this, it results in the error self.context.$implicit.myFunctionName is not a function. I want to display photos from the Flickr API in my Ionic2 app.…
1
vote
1 answer

Angular2.0.0 - Dynamically setting template url

I wanted to create a ContainerComponent that surrounds ng-content depending on the isModal:boolean. My approach is not working because it only recognizes the last tag, so I wanted to separate the TemplateUrl for modal and non-modal. Is…
Luka Šilje
  • 605
  • 2
  • 8
  • 19
1
vote
2 answers

Why does using the negation of a variable break data binding in Angular2?

This seems like it should be straight-forward, but I can't see what I'm doing wrong. I have a form on which some components are optionally enabled based on a yes/no radio button. I'm attempting to set the disabled attribute based on the boolean…
Mutmansky
  • 577
  • 6
  • 16
1
vote
0 answers

Getting Satinizer warning when calling sanitizer.sanitize

I have a component that gets some string from a service, this service loads its strings from a json. Since this json can be altered by an attacker (connecting to the server etc) I want the string to be sanitized before being shown in order to avoid…
Supamiu
  • 8,501
  • 7
  • 42
  • 76
1
vote
1 answer

Restricting scope of Style to grand-child from child in Angular 2?

Here is the structure. ........ Now, my parent has main global css stylesheet with bootstrap and all color-palettes. In my child, I gave another…
Parth Chokshi
  • 642
  • 4
  • 16
1
vote
1 answer

Angular 2 set selected property

I am trying to set selected option in Angular2. I have a select.