angular2-template

Can Angular 2 parse links received from external CMS to be resolved as internal

独自空忆成欢 提交于 2019-12-11 02:57:44
问题 We are working on a decoupled project with Drupal as our backend and Angular as our front-end. Everything is nearing completion but certain (dynamic, as in created in Drupal) pages require links to different pages of the angular app. For example: An editor creates an FAQ question in Drupal with an answer containing a link to the Pricing page of the angular app. (Q: How much does this service cost? A: Check out our [pricing] page) User on frontend opens FAQ page Angular loads our FAQ page

Angular2: data binding with routing children

别说谁变了你拦得住时间么 提交于 2019-12-11 01:37:49
问题 I have a simple setup. I'm using a routing component with multiple child components which are loaded dynamically depending on the route. I'd like for some of these child components to have data-binding with its routing parent. I'll add an @Output() property to the child, but how can I make the routing parent listen for the events that this event-emitter emits? Normally in a template with a statically defined component I'll do something like this: <child (myevent)="handleEvent($event)"> and

Primeng - Cant display array items in a column

喜你入骨 提交于 2019-12-11 00:59:21
问题 I am using primeng datable in Angular 2. My model is an array of products . Every product has an array of locations . That array of locations have a property name . How to display every name of locations array in a row of product ? Example: If first product has 5 name in its locations array, it should display 5 names in locations column Currently i am doing this. <p-dataTable [value]="products" selectionMode="single" [(selection)]="selectedProduct" (onRowSelect)="onRowSelect($event)"

Angular2 Parent Component with multiple instances of child component

╄→гoц情女王★ 提交于 2019-12-11 00:03:47
问题 I have a parent component with a template that references multiple instances of the same child component. The child components would have the same component/template implementation but should be instantiated multiple times and would render different data sets. I looked into a lot of posts like Instance Angular 2 Component Two times but all of them seemed to use the deprecated directives component attribute. parent.template.html <child-component data="foo"></child-component> <child-component

How to assign selected value to “Select” when value is of class object in angular 2

ⅰ亾dé卋堺 提交于 2019-12-10 23:32:12
问题 Using angular 2.2.4 from following links learned select list of class object: How can I get new selection in "select" in Angular 2? https://stackoverflow.com/a/35945293/4773561 Angular 2 Dropdown Options Default Value & implemented as follows <select id="st" name="state" [(ngModel)]="selectedState" (ngModelChange)="onStateSelectedForVanue($event)"> <option *ngFor="let state of states" [ngValue]="state">{{state.name}} </option> </select> here 'states' is list of State Class object export class

How to set bindings in ngFor in Angular 2?

£可爱£侵袭症+ 提交于 2019-12-10 22:23:22
问题 NOTE : I found several similar questions but none really answered my (generic) question I have this component.ts first: string; second: string; third: string; fields = ["first", "second", "third"]; I want to be able to generate in component.html a complex component ( without importing a custom-defined directive ) which includes: Required : ngModel binding based on fields[i] (e.g. i = 0, fields[i] = "first", ngModel = first ) Desiderable : use fields[i] as strings to assign to any DOM element

Angular2 No provider for Renderer! (NgModel -> Token NgValueAccessor -> DefaultValueAccessor -> Renderer)

£可爱£侵袭症+ 提交于 2019-12-10 20:49:13
问题 I custom modal of customModal.ts in shlomiassaf/angular2-modal. Specific, i add a input contain ngModel, it imported FORM_DIRECTIVES and directives. The issue when run 'No provider for Renderer! (NgModel -> Token NgValueAccessor -> DefaultValueAccessor -> Renderer)' Please help me resovle this issue. Thanks. 回答1: I see two possibilities: The corresponding provider isn't specified at the component or application level. I don't think that the problem because I already inject a Renderer without

Angular 2 sibling components 2 way binding

那年仲夏 提交于 2019-12-10 18:13:05
问题 I am having 2 sibling components displayed at the same time to the user. One of them is a QuestionList which takes an array of questions from service and display list of questions. Once you click on a particular question it displays (next to the list) question details like seen below Question detail component uses router to take question id from the URL and stores it in a separate variable called selectedQuestion like this: selectedQuestion: Question; ngOnInit() { this.subscription = this

Angular 6 + Popper.js (without jQuery)

家住魔仙堡 提交于 2019-12-10 18:03:53
问题 I am trying to setup Popper.js to work with angular 5, without bootstrap or jquery. I tried following this https://github.com/FezVrasta/popper.js/#react-vuejs-angular-angularjs-emberjs-etc-integration, but it is not exactly a point A to B description for angular applications. I installed Popper.js via npm npm install popper.js --save then I chose to bundle the esm module to my angular-cli scripts "scripts": [ (...) "../node_modules/popper.js/dist/esm/popper.js" ], Since esm/popper.js exports

Angular2 template expression called twice for each component on change-detection

落花浮王杯 提交于 2019-12-10 17:20:26
问题 Pretty standard situation. There is one parent component <item-list> . Inside its template with *ngFor generated 20 child components <item-block> . Child component styles set with [ngStyle] directive and template expression that calls function setStyles() . The problem (or maybe not) is that when any event emitted on one specific child element, expression setStyles() executed twice for each of child components. So if we click on one specific item in our example, and we have 20 <item-block>