components

How to share service data between components correctly in Angular 2

喜欢而已 提交于 2019-12-07 03:19:27
I want to create a service to get data from .json file once and share it to multiple subscribers. But now with my solution number of requests to get data from .json file equals to a number of a subscibers for my service. getconfig.service.ts import {Injectable} from 'angular2/core'; import {Http, Response} from "angular2/http"; @Injectable() export class ConfigService { config: any; http: Http; constructor(http: Http) { this.http = http; console.log('Inside service'); this.config = this.http.get('/config.json'); } } robotui.component.ts ... import {ConnectionService} from '../services

Free font and color chooser for WPF?

孤者浪人 提交于 2019-12-07 03:13:34
问题 I'm looking for some good font chooser and color chooser components for WPF. I was trying to find some standard solutions like Winforms components but there seems to be none (I wonder why?). It does not have to be perfect, someshing from code project would be enought but I would prefer good looking intuitive-to-use components. Thank you 回答1: Look at ColorPicker from Extended WPF Toolkit 来源: https://stackoverflow.com/questions/4697410/free-font-and-color-chooser-for-wpf

Is it possible to have “movable”/“draggable” components like JButtons, JTextFields in a JFrame?

末鹿安然 提交于 2019-12-07 03:01:29
问题 Basically I plan to place some buttons, textfields, labels, etc. on a JFrame and I would like to make it possible that a user can move the different components around on that JFrame with the mouse. I have seen various ways with MouseListeners, subclassed JComponent code, DropSource/DropTarget implementations and so on, but I'm unsure which is the "recommended" way (I don't need to support "drag and drop" between different Frames/Applications which is what most examples seem to do). 回答1: The

JSF component binding - some confusion

核能气质少年 提交于 2019-12-07 02:23:12
问题 From web pages like this one, http://www.jsftutorials.net/components/step5.html I understand that the binding attribute in JSF tag/view component is to bind the view component to a Java instance of the UI component in the backing bean. E.g., that's what is done in the following code: <h:inputText value="#{ myBean.someProperty}" binding="#{ myBean.somePropertyInputText}"/> But sometimes I see code like this: <h:commandButton id="t1" binding="#{foo}" value="Hello, World!" onclick="alert('I am #

Android custom attributes not showing

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 02:01:02
问题 I've seen a lot of posts with people wanting to know how to get custom attributes for a custom component but that is not my question. I have created a custom component and I'm trying to add attributes but when I add the namespace at the top of my xml file it only finds two random custom attributes "paddingEnd" and "paddingStart". <resources> <declare-styleable name="menu_item_attrs"> <attr name="imageId" format="integer" /> <attr name="menuText" format="string" /> </declare-styleable> <

Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1

流过昼夜 提交于 2019-12-06 21:39:36
问题 I'm trying to use the new Navigation Architecture Component for android and I'm getting the error Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1 when I'm defining the lifecycle_version to "1.1.1" I'm basically just copying and pasting what is in the documentation so I'm running out of ideas of what is wrong in here :( apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android {

Angular 2 : export component on a module and import and use it inside a module

有些话、适合烂在心里 提交于 2019-12-06 19:48:00
问题 I have a feature module called CustomerInfoModule which exports a CustomerInfoComponent. see below. import {NgModule} from '@angular/core' import {RouterModule} from '@angular/router' import {CustomerInfoComponent} from './customer-info.component' @NgModule({ declarations:[CustomerInfoComponent], exports:[CustomerInfoComponent] }) export class CustomerInfoModule{ } I want to import and use this CustomerInfoComponent inside MissedCollectionsComponent. I am getting typescript error '.module"'

How to use a react component fetched from an api?

倖福魔咒の 提交于 2019-12-06 19:16:41
I have an api which provides me a with Webpack processed react component which looks like the following: module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var u=t[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if

How to load dynamic HTML into DIV with component? Angular5

雨燕双飞 提交于 2019-12-06 17:47:37
问题 I have been trying to find the solution of this problem from two days. Unfortunately, I can not get what I want. I am using Angular5. <div class="form-group col-md-12" [innerHTML]="GetItemsOfHolder(item.children[1],1, 'UserConfigGroupsLabelHolder') | keepHtml"></div> This is what my function looks like: GetItemsOfHolder(item: any,divName:string, recursive: boolean = false,typeName:string="") { return html; } Everything works fine, unless The html which I am returning contains one package

Component without template

旧时模样 提交于 2019-12-06 17:45:25
问题 I have a bit of code that makes an api call to a server and returns some JSON. It did exist as a method in my component but as it is getting a bit long I want to extract it to it's own file In vuejs what is the best practice here. should it be a component without a template? How would this work? will I just create an es6 module? 回答1: I would suggest using a mixin here. In a file like myCoolMixin.js define your mixin... export default { methods: { myAwesomMethod() { //do something cool... } }