angular-components

How to get inner html of Angular6 component and add it to component template?

怎甘沉沦 提交于 2019-12-13 19:17:04
问题 I want to be able to pass components and other html into other components in this way: <app-container-component> <h3>All these items should be displayed in parent component</h3> <app-another-component></app-another-component> </app-container-component> How can I read inner items of container-component and render them inside component template? 回答1: You can use the concept of "@Input","@Output-EventEmitter".By using these properties you can pass data from parent component to child component

How to update Parent Component data from Child Component without two way data binding in angular 1.5.x?

浪尽此生 提交于 2019-12-13 07:15:10
问题 Sorry if it's a silly question but i am a noob in angular 1.5.x I am using es6 class based components with one way data bindings throughout the app(best practices as far as i know). I have a Container Component . It has a Sidebar Component and a Content Component . I fetch the menu options (array or object) in Container Component and pass it to Sidebar Component and Content Component using one way data binding as attributes. I want to update the Container Component whenever i change menu

implicit context is undefined, angular 7

独自空忆成欢 提交于 2019-12-13 04:12:22
问题 Right, so I am iterating over an array of information and the information is showing the way that I want it to, however, I am getting some amaing looking errors in my console: ERROR TypeError: "_v.context.$implicit is undefined" api service: private extractData(res: Response) { let body = res; return body || {}; } getWeather(city: string, isoCode: string): Observable<any> { return this.http.get(`${this.endPoint}${city},${isoCode}${this.constants.apiKey}`) .pipe(map(this.extractData)); }

Angular - Can't resolve 'croppie' in node_modules\ngx-croppie\esm5

有些话、适合烂在心里 提交于 2019-12-13 03:47:40
问题 I'm trying to add a croppie to my Angular project, and by following this link: https://www.npmjs.com/package/ngx-croppie I executed this command : npm i ngx-croppie And this added croppie and ngx-croppie to my project in node_modules, but now I'm facing next error: And Indeed when I open my component, there is a this issue: And in my node_modules there is no croppie folder but in node_modules/@types/ croppie exist as in next image: 回答1: please uninstall ngx-croppie package and again install

Angular Parent-Child Component: Load Child on Parent click

拥有回忆 提交于 2019-12-13 03:07:45
问题 I have article list and article detail component. Article List: -- list of articles. load into html as a table. handled a click event and set the article id -- use the article id property to send a signal to article detail to load as @Input property. Article Detail: -- @Input property listen from list and register ng-OnChange event to handled any change -- Load the article detail view model (with more detail) -- Use Reactive Form to load all the property to correct formgroup. -- Use sample

Load css from a CDN in an Angular 2 Component

爱⌒轻易说出口 提交于 2019-12-12 10:55:05
问题 As the title says, i want to include external css in an Angular 2 component. Here's how i am doing it now: import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-auth', templateUrl: './auth.component.html', styleUrls: [ 'https://fonts.googleapis.com/css?family=Dosis:400,500,600,700', 'http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', './assets/css/bootstrap.min.css', './assets/css/main.css', './assets/css/responsive.css', './auth.component.css',

Angular 4 call directive method from component

此生再无相见时 提交于 2019-12-12 09:35:58
问题 i'm trying to build a structural directive that will change the parent DOM structure either invoked by using its selector (static) or by calling its public method(dynamic). Using the directive selector in a html template works fine without any issues. I'm trying to figure out if we an achieve the same without using it in template and by calling the directive method. my-directive.ts @Directive({ selector: '[sampleDirective]' }) export class SampleDirective { ... constructor(..) { this

How to use a child template inside a custom table component to display each row?

走远了吗. 提交于 2019-12-12 05:27:08
问题 I've tried so many things and failed that my code ended up being a total mess. I'm open to anything but, in case you want a base: The most promising approach I found was the following, but failed with the exception "templateRef.createEmbeddedView is not a function": app.component.html <br> <mt-table [fields]="userFields" [(rows)]="users" [pageSize]="10" [searchString]="searchString" class="round"> <template let-row="row"> <td> {{ row.name }} </td> <td> <i class="fa fa-{{ row.gender === 'male'

Unable to Inject angular services in to dynamically loaded component

喜欢而已 提交于 2019-12-12 04:54:22
问题 I have successfully loaded a component dynamically using ComponentFactoryResolver and everything is working as I expected. But my problem is , I have one service named ComponentStoreFactory which I have already injected in other components in my application and it's working fine but when I inject this service in to Dynamically Loaded Component I am getting the below error. Uncaught Error: Can't resolve all parameters for the MyDynamicComponent Service(it's available in an independent module

Login with linkedin and get user information in Angular2

谁都会走 提交于 2019-12-12 02:33:31
问题 I am new to Angular2, I want to integrate linked login functionality and get the currently singed in user information for my Angular2 project. I have created App in using linkedin developer account and have Client ID and Client Secret and tried below code but it gives me error ZoneAwareError {__zone_symbol__error: Error: You must specify a valid JavaScript API Domain as part of this key's configuration. at ht……} I tried both the way for declaring api key using double quotes ( api_key: