angular7

CdkDragDrop and ngTemplateOutlet

此生再无相见时 提交于 2019-12-02 09:31:33
问题 I'm trying to use Drag&Drop features relased with Angular Material 7. I separated my template in reusable pieces using ngTemplateOutlet and every option can be either a Thing ™ or a nested Thing ™ which have some more sub-Things ™. Nested Things ™ are displayed as an expansion panel. I want all the first-level Things ™ to be re-orderable as if thery were a list. ( Ok, ok, it's obvious that's a reorderable sidenav with normal and nested options, just pretend it's not so obvious ) This is the

How to implement angular 7 drop-down with images?

青春壹個敷衍的年華 提交于 2019-12-02 08:15:33
问题 I'm creating angular 7 app, and using mat-select for drop-down. Now i want add image within each item of the mat-select See the image below: 回答1: Ensure you have images in the array which you're providing in the mat-option ; then, create an image tag and provide the image source to it. relevant HTML : <h4>Basic mat-select with images</h4> <mat-form-field> <mat-label>Favorite food</mat-label> <mat-select> <mat-option *ngFor="let food of foods" [value]="food.value"> <img src='{{food.img}}'> {

How to assign dynamically components/fields permissions to certain roles in Angular?

半腔热情 提交于 2019-12-02 07:37:14
问题 I am working on an Angular 7 project and developing a role/permission management dashboard where a super-admin can assign and manage rolesx and their permissions respectively by clicking the check boxes. What I was specifically tasked to do is implement something similar to what is implemented in VtigerCRM So when the super user assigns permission, the user should be assigned access to that particular component and/or that particular field in the component. I'm wondering is there a way to

CdkDragDrop and ngTemplateOutlet

删除回忆录丶 提交于 2019-12-02 05:18:44
I'm trying to use Drag&Drop features relased with Angular Material 7. I separated my template in reusable pieces using ngTemplateOutlet and every option can be either a Thing ™ or a nested Thing ™ which have some more sub-Things ™. Nested Things ™ are displayed as an expansion panel. I want all the first-level Things ™ to be re-orderable as if thery were a list. ( Ok, ok, it's obvious that's a reorderable sidenav with normal and nested options, just pretend it's not so obvious ) This is the code I initially wrote. <div cdkDropList (cdkDropListDropped)="dropItem($event)" lockAxis="y"> <ng

How to implement angular 7 drop-down with images?

亡梦爱人 提交于 2019-12-02 04:21:36
I'm creating angular 7 app, and using mat-select for drop-down. Now i want add image within each item of the mat-select See the image below: Ensure you have images in the array which you're providing in the mat-option ; then, create an image tag and provide the image source to it. relevant HTML : <h4>Basic mat-select with images</h4> <mat-form-field> <mat-label>Favorite food</mat-label> <mat-select> <mat-option *ngFor="let food of foods" [value]="food.value"> <img src='{{food.img}}'> {{food.viewValue}} </mat-option> </mat-select> </mat-form-field> relevant TS : import { Component } from '

Uncaught SyntaxError: Unexpected token export - popper.js error

邮差的信 提交于 2019-12-02 03:29:42
Angular is giving the error: popper.js in bootstrap 4 gives SyntaxError Unexpected token export I'm getting this error from browser console. Even I changed the popper.min.js location reference but no use.. node_modules/popper.js/dist/umd/popper.min.js node_modules/popper.js/dist/ems/popper.min.js Angular.json "scripts": [ "node_modules/bootstrap/dist/js/bootstrap.min.js", "node_modules/jquery/dist/jquery.slim.min.js", "node_modules/popper.js/dist/popper.min.js" ] Bootstrap.min.js is depend on the popper.min.js , change the order as follows, "scripts": [ "node_modules/jquery/dist/jquery.slim

TypeError: Object(…) is not a function for angular-material

我是研究僧i 提交于 2019-12-01 22:16:47
In angular 7, trying to use angular material mat-dialog-content. While importing in app.module.ts it gives the following error: TypeError: Object(...) is not a function like: Uncaught TypeError: Object(...) is not a function at platform.es5.js:102. package.json { "name": "image-cropp", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^7.2.15", "@angular/cdk": "^8.0.1", "@angular/common": "~7.2.0", "@angular/compiler": "~7.2.0", "@angular/core

Angular Material - mat-table not rendering data from rest api

吃可爱长大的小学妹 提交于 2019-12-01 16:57:55
问题 I've been trying to implement this table example from Angular Material without luck I don't understand what I'm doing wrong, the data which is being provided by my REST endpoint is clearly visible on the console output. My suspicions are that maybe the data isn't quite loaded yet, when the table is rendered. Any help is appreciated, thanks! lap.component.ts import {Component, OnInit, ViewChild} from '@angular/core'; import {MatPaginator, MatSort, MatTableDataSource} from '@angular/material';

virtual scroll on Angular 7 is not visible - the height is zero by default

走远了吗. 提交于 2019-12-01 16:53:58
问题 Scenario: Tried a basic virtual scroll test reading this blog post the array had lots of items there was no error the list loaded in a virtual scroll but the height of it was 0 by default quick fix was to set the height for cdk-virtual-scroll-viewport to 500px or set the height for class 'example-viewport' in app.component.css Question : what is the proper way to overcome this zero height? sample at https://stackblitz.com/edit/angular-efdcyc 回答1: use min-height of 100% for the viewport and

Add Bootstrap 4 to Angular 6 or Angular 7 application

孤人 提交于 2019-12-01 15:06:10
I am working on Angular application using bootstrap 4. I need help related to scss adding in my angular application. My question is: Is the way of adding bootstrap 4 scss same in Angular 6 and Angular 7 or not? i.e. npm install bootstrap --save And, open angular.json file and add bootstrap file path to the styles section. Like: "styles": [ "src/styles.css", "node_modules/bootstrap/dist/css/bootstrap.min.css" ], Is the above way is same for both the version of angular. You need to do the following: Add Bootstrap to package.json (which is done with npm install bootstrap --save) Add Bootstrap to