angular2-template

Angular 2 Jquery Plugin - Issue when navigate away then back to page

前提是你 提交于 2019-12-24 09:29:57
问题 I am using the Seriously plugin to display html video onto a canvas element. This works fine for the first visit to the page but when you navigate back the videos all disappear. there is no console errors at all import {Component, ViewChild, ElementRef, OnInit, } from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {RouteTree, CanDeactivate, ROUTER_DIRECTIVES } from '@angular/router'; declare let jQuery: any; declare let Seriously: any; declare let seriously: any; declare

Angular2 the for attribute on a label does not link it to the input

情到浓时终转凉″ 提交于 2019-12-24 08:00:46
问题 I am working with Angular2 RC5. I have a component encapsulating a label and an input import { Component, Input} from '@angular/core'; @Component({ selector: 'my-input', template: ` <div class="mx-field" > <label [attr.for]="id"><ng-content></ng-content></label> <input type='text' id = "{{id}}" /> </div> ` }) export class InputComponent { @Input() id: string; } It is called from any template as follows <my-input id="inputcontrol">input</my-input> The problem is that when I click on the label

interpolation to a css class in an external file angular 2

丶灬走出姿态 提交于 2019-12-24 07:49:52
问题 I'm wondering if is possible to pass a variable to a css class into an external css file in angular 2, like from: import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'app works!'; bgc: string = 'orange' } then on the "app.component.css" I would like to pass like .mydiv{ background: {{bgc}}; } Is this possible? 回答1: I don't think this would be possible. If

Catch event in sibling component

久未见 提交于 2019-12-24 07:48:29
问题 My app looks like this : <my-app> <my-toolbar></my-toolbar> <my-cube-container></my-cube-container > </my-app> I'd like to communicate from my-toolbar to my-cube-container . I'm sending an event from the toolbar : @Component({ selector: 'my-toolbar', template: `... <i class="fa fa-search-minus ic" (click)='onZoom(-1)' aria-hidden="true"></i> `, }) export class ToolbarComponent { @Output() zoomEvent: EventEmitter<number> = new EventEmitter(); onZoom(value:number){ console.log('event sent');

Catch event in sibling component

佐手、 提交于 2019-12-24 07:48:18
问题 My app looks like this : <my-app> <my-toolbar></my-toolbar> <my-cube-container></my-cube-container > </my-app> I'd like to communicate from my-toolbar to my-cube-container . I'm sending an event from the toolbar : @Component({ selector: 'my-toolbar', template: `... <i class="fa fa-search-minus ic" (click)='onZoom(-1)' aria-hidden="true"></i> `, }) export class ToolbarComponent { @Output() zoomEvent: EventEmitter<number> = new EventEmitter(); onZoom(value:number){ console.log('event sent');

Angular 2 parsing template error

泄露秘密 提交于 2019-12-24 07:19:15
问题 I'm new to angular 2, and I'm using angular-rc-4 version. When I combine angular 2 with bootstrap icon, the template can't be parsed. Unexpected closing tag "li" Thanks for your help Below is my code: import { Component } from '@angular/core'; import { CourseService } from './course.service'; import { AutoGrowDirective } from './auto-grow.directive'; @Component({ selector: 'courses', template: ` <h2>Courses</h2> {{ title }} <input autoGrow [(ngModel)]="title"/> <input type="button" (click)=

Compile template before projecting the content. Dynamic projecting?

痴心易碎 提交于 2019-12-24 07:13:46
问题 In my project I am meeting several times the same problem, and yet, I have not been able to find a proper solution. I suspect it is all part of this issue, but it sounds to me like a very normal use case. Many times I have a component with a template such as: <my-component><ng-content></ng-content></my-component> where somewhere in the projected content is trying to get the instance of <my-component> . This simply does not work because the projected component gets resolved before <my

Unable to display object array of an object in Angular 2 template

匆匆过客 提交于 2019-12-24 07:12:43
问题 I am trying to display an object values in angular 2 templates and specifically when I try to get an object array using ngFor gives me an error saying EXCEPTION: Uncaught (in promise): Error: Error in ./SgDetailComponent class SgDetailComponent - inline template:15:7 caused by: Cannot read property 'tags' of undefined I can get string/number property but not object property. Here's my component.ts @Component({ selector: 'app-sg-detail', templateUrl: './sg-detail.component.html', styleUrls: ['

Angular2 Outputs in ES5?

女生的网名这么多〃 提交于 2019-12-24 02:59:14
问题 Here is an example code to demonstrate outputs in Angular 2 using ES5. But I get an TypeError: Cannot read property 'subscribe' of undefined error. var SampleComponent10 = ng.core.Component({ selector: "sampleten", outputs: ["click"], template: "" }).Class({ constructor: function(){ setInterval(function(){ this.click.next({}); }.bind(this), 10000) } }) var SampleComponent11 = ng.core.Component({ selector: "sampleeleven", directives: [SampleComponent10], template: "<sampleten (click)='clicked(

how to add nested forms in angular2

蓝咒 提交于 2019-12-24 02:15:23
问题 Image contains problem I have created a form and it is adding rows dynamically from add button but i have also created a button from which i need to add only some components from that link.Add more link button is used to create only those two components. i have used nested form approach, dynamic form approach but not able to do the same. Help needed. HTML:- <div class="container"> <p> </p> <div> <form [formGroup]="searchForm" novalidate (ngSubmit)="submit(searchForm.value)"> <div