angular7

How can I use JavaScript code in Angular 7?

℡╲_俬逩灬. 提交于 2020-01-03 03:43:33
问题 I'm trying to make a collapsible navbar with the help of MaterializeCSS when used on mobile screen and need to use JavaScript code in it. Where should I write this JavaScript code? This is the code I want to use: **$(document).ready(function(){ $('.sidenav').sidenav(); });** 回答1: Step-1: Created a js folder inside the assets folder. Step-2: Created a new .js file inside the js folder. Assets -> js -> example.js Step-3: Added path of the example.js in angular.json inside the scripts array.

Error There is no directive with “exportAs” set to “matTableExporter” when using MatTableExporter

与世无争的帅哥 提交于 2020-01-03 01:40:12
问题 From the docs example I'm trying to use the mat table exporter, this way: <ng-container> <mat-card class="mat-card py-0"> <mat-card-header class="label"> <ng-container> <mat-card-title>{{titoloTabella}}</mat-card-title> <button mat-button class="align-right" (click)="changeClass()"> <mat-icon [ngClass]="(rotate)?'rotate':'no-rotate'">keyboard_arrow_down</mat-icon> </button> </ng-container> </mat-card-header> <table mat-table matSort [dataSource]="dataSource" matTableExporter #exporter=

Difference between global scss file and scss file for component in Angular

人盡茶涼 提交于 2020-01-02 05:15:34
问题 In a recent Angular 7 project, I have a component (defined in the file file-list.component.ts ) in which there is a mat-paginator (a component from Angular material component library). When I want to change the background color of the mat-paginator , I first tried to put .mat-paginator-container { background-color: yellow; } in film-list.component.scss (the stylesheet for associated with this component), the background color of the paginator did not change. When I put this in app.component

No provider for InjectionToken angularfire2.app.options

痴心易碎 提交于 2020-01-01 10:14:12
问题 Recently I started to learn to use the concept of firebase in combination with angular. As a start, I try to make the login process work. Currently, I get an ennoying error when I try to navigate to the login page and I cannot figure out what is causing the error. The error I get is: ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[AngularFireAuth -> InjectionToken angularfire2.app.options]: StaticInjectorError(Platform: core)[AngularFireAuth -> InjectionToken

Angular 7: ChangeDetectorRef detectChanges() causes infinite loop when called from inside a subscription

ⅰ亾dé卋堺 提交于 2019-12-31 06:53:33
问题 I am posting here after reading all the material related to change detection and similar post and failing to solve my problem. ChangeDetectorRef detectChanges() causes infinite loop when called from inside a subscription. If I don't call detectChanges , I get ExpressionChangedAfterCheck error. I seriously don't know how to solve, and why is the ExpressionChangedAfterCheck error comes ngAfterViewInit() { this.route.params.subscribe((params) => { this.userId = params.userId; if (this.userId !=

Angular 7: ChangeDetectorRef detectChanges() causes infinite loop when called from inside a subscription

ぃ、小莉子 提交于 2019-12-31 06:53:07
问题 I am posting here after reading all the material related to change detection and similar post and failing to solve my problem. ChangeDetectorRef detectChanges() causes infinite loop when called from inside a subscription. If I don't call detectChanges , I get ExpressionChangedAfterCheck error. I seriously don't know how to solve, and why is the ExpressionChangedAfterCheck error comes ngAfterViewInit() { this.route.params.subscribe((params) => { this.userId = params.userId; if (this.userId !=

Nested Drag and Drop in with Angular 7 Material CDK

喜欢而已 提交于 2019-12-30 11:05:41
问题 I've got a nested tree (Not the tree component) of drag and drop lists. When dragging items around in drop lists that are contained inside of another drop list - Enter / Exit events are firing for both drop lists, meaning that when an item is dropped it could either be dropped into the inner drop list or the container drop list depending where it was dropped (Note: These lists are all linked to each other) I'm thinking at the moment that the best solution will to be suppress events firing for

Get route parameters Angular?

自作多情 提交于 2019-12-30 07:49:23
问题 Routing rules are: const routes: Routes = [{ path: "", component: SkeletonComponent, children: [{ path: "dictionary", component: DictionaryComponent, children: [ { path: ":dict/:code", component: VersionsComponent }] }]; URL looks like: http://localhost:4200/dictionary/Gender/5 Where Gender is parameter: :dict and 5 is parameter :code . I tried to get parameters inside component VersionsComponent : ngOnInit() { console.log(this.activateRoute.snapshot.params['dict']); console.log(this

Create SVG circle using path with 6 segments

不羁的心 提交于 2019-12-29 09:32:30
问题 how to create circle using svg with multiple path with 6 segments in angular 7. Each segments have different path and also gap in between each segment. refer below link for reference. Want to use same image for svg element. how to create in angular 7? 回答1: This is how I would do it: I'm creating a path id="segment" and I'm using and rotate it 6 times: let R = 45;// the outer radius let r = 15;// the inner radius //the radius for the text let textR = r + (R - r)/2 // the angle for the slice

cannot find name 'require' in angular 7(typescript 3.1.3)

好久不见. 提交于 2019-12-29 05:45:06
问题 My question is why this error shown? ERROR in src/app/p2p/p2p.component.ts(14,16): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node . I have install @types/node in app/tsconfig.app.json have add "types": [ "node" ], "typeRoots": [ "../node_modules/@types" ] but there is error cannot find 'require' 回答1: The problem also remained after adding it to my tsconfig.json, but additionaly adding the following line to tsconfig.app.json