components

Angular2: Passing an object to bind event from parent to child

与世无争的帅哥 提交于 2019-12-11 08:17:51
问题 The binding works fine for title, subtitle, button.icon and button.name but not for button.action parent.component.html <app-title [title]="title" [subtitle]="subtitle" [buttons]="buttons"></app-title> parent.component.ts export class ParentComponent { actionOne() { ... } title = 'Title'; subtitle = 'Subtitle'; buttons = [ { 'name': 'Name1', 'icon': 'Icon1', 'action': 'actionOne()'}, { 'name': 'Name2', 'icon': 'Icon2', 'action': 'actionTwo()'}, { 'name': 'Name3', 'icon': 'Icon3', 'action':

Angular 4 and bootstrap - Adding container class to component selector

扶醉桌前 提交于 2019-12-11 08:04:06
问题 I am currently adding bootstrap's container class to the component selector so all child elements react to bootsrap classes for example in the index.html file i've applied <app-root class="container"></app-root> and in the bootstrapped app.component.html I've applied <app-header class="row"></app-header> Not sure if this is the recommended approach? 回答1: I recomend in app.component put the container class <div class="container"> <app-header></app-header> </div> and in the component app-header

Using inspect on the HTML doesn't highlight custom component

我的梦境 提交于 2019-12-11 07:37:38
问题 I'm trying to inspect a simple custom component made in Ionic 3. When i inspect it, chrome doesn't highlight the area of the custom component. It only highlights the area if i select a element inside the custom component. To help u understand it better i've put screenshots of the problem im facing. The picture shows a div element inside the custom element star-rating, which is being highlighted. This is okay. But now when i select star-rating element(which is the custom component) , it doesn

Dispatching custom event from a custom component

会有一股神秘感。 提交于 2019-12-11 07:11:44
问题 I have a custom Flex 4.5 component (to be used in a List) - Game.mxml (represents a clickable playing table in a card game): <?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:comps="*" width="160" height="160" autoDrawBackground="false" creationComplete="init(event)"> <fx:Metadata> [Event(name="pref_event", type="PrefEvent")] </fx:Metadata> <fx:Script> <!

How use N views in sample app in react native

谁都会走 提交于 2019-12-11 06:49:27
问题 I have some doubt in React Native. I read this answer (How to do a multi-page app in react-native?) but I stayed with a little bit doubt: I use Navigator to many views in React Native App, but how I do to N componentes? For example, if I have 5 different views I have use the before code five times... and n times? 回答1: to ellude more on my comment. instead of this if (routeId === 'SplashPage') { return ( <SplashPage navigator={navigator}/> ); } if (routeId === 'LoginPage') { return (

Graphics2D Rotation Precision Issues

删除回忆录丶 提交于 2019-12-11 06:37:31
问题 I am drawing 4 stacked rectangles, rotating the canvas about a point and then drawing that same shape again but the stacked rectangles aren't remaining completely aligned. Here's a screenshot: As you can see, the first, unrotated block is perfect but the following ones are misaligned. Why is this happening and how can I prevent it? SSCE //Just import everything to keep it short and sweet import java.awt.*; import java.awt.geom.*; import javax.swing.*; @SuppressWarnings("serial") public class

Change component content on route changes Angular 2

回眸只為那壹抹淺笑 提交于 2019-12-11 06:27:03
问题 I wish to change the action-bar links when changing components in my router-outlet. Each component may contain its own set of action-links, but also could be empty, meaning that the action-bar would not render anything. I've got the following ContentComponent template: <app-header></app-header> <div class="page-container"> <app-sidebar-left></app-sidebar-left> <div class="page-content-wrapper"> <div class="page-content"> <h1 class="page-title"> Product Builder <small>Dashboard</small> </h1>

Angular 4.1.0 in Plunker: adding component returns 404 XHR Error

扶醉桌前 提交于 2019-12-11 06:13:58
问题 I'm trying to use Angular 4 with Plunker and I can't manage to add a new component. The URL is: https://plnkr.co/edit/1umcXTeug2o6eiZ89rLl?p=preview I've just created a new component - mycomponent.ts - with the minimum of declarations. Then, in app.ts , I'm adding the importing declaration: import {MyComponent} from "./mycomponent"; and add the component in the declarations array within the @NgModule decorator: declarations: [ App, MyComponent ], This last bit breaks it and returns a 404 XHR

Angular2: One instance of module in multiple modules

天涯浪子 提交于 2019-12-11 05:54:20
问题 Let's make example for ng2-translate plugin. I have root AppModule , and children TopPanelModule and PagesModule . I configure ng2-translate for AppModule . @NgModule({ imports: [TranslateModule.forRoot({ provide: TranslateLoader, useFactory: (http: Http) => new TranslateStaticLoader(http, '/assets/i18n', '.json'), deps: [Http] })], exports: [] }) export class AppModule { constructor(translateService: TranslateService) { } } In AppComponent I set languages and basic configuration for

Undefined Behavior with v-for and custom components

会有一股神秘感。 提交于 2019-12-11 05:49:14
问题 First off, please excuse the awful code (we don't have time to fix right now). I know eval is horrible, but for our purposes it was the only thing that worked for us this easily. This is how we add and remove the rows: methods: { addRow: function() { let lastRow = eval(`this.$parent.json${this.path}[this.$parent.json${this.path}.length - 1]`); lastRow = Object.assign({}, lastRow); eval(`this.$parent.json${this.path}.push(lastRow)`); this.$forceUpdate(); }, removeRow: function(index) { //eval(