angular7

Add Bootstrap 4 to Angular 6 or Angular 7 application

人走茶凉 提交于 2019-12-01 13:55:37
问题 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. 回答1: You need to do the

How to include an Angular 7 application in an existing html file and website?

最后都变了- 提交于 2019-12-01 13:08:51
问题 I have on one side an existing website, on the other I have an Angular 7 application component. I'd like to edit my existing someusecase.html and reuse my Angular 7 application like so e.g. <html lang="en"> <head> <meta charset="utf-8"> <title>How to import Angular 7 App?</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <app-root></app-root> </body> </html> What would I need to include in the html for this to work? I'm after e.g.

Nested Drag and Drop in with Angular 7 Material CDK

和自甴很熟 提交于 2019-12-01 10:34:38
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 the container list if the drag is currently over an inner list but I'm not sure if this is the best

How to use reportProgress in HttpClient in Angular? [duplicate]

北城以北 提交于 2019-12-01 03:48:37
问题 This question already has answers here : Angular file upload progress percentage (5 answers) Closed last month . I am downloading file using HTTP POST method. I want to call another method to show download progress to end user until file download complete. How to use reportProgress in HttpClient for this. downfile(file: any): Observable<any> { return this.http.post(this.url , app, { responseType: "blob", reportProgress: true, headers: new HttpHeaders( { 'Content-Type': 'application/json' }, )

Angular 7 Component Inheritance using a global injector

老子叫甜甜 提交于 2019-11-30 22:39:58
I've been using the approach described in an MSDN blog post to simplify extending components without needing to provide all the dependencies in the super() call. However this has stopped working in Angular 7 with Typescript 3. So what's happening is that after bootstrapping, I'm trying to store the injector in a service and afterwards I try to retrieve it. platformBrowserDynamic().bootstrapModule(AppModule).then(ref => { // Store module's injector in the AppInjector class console.log('Expected #1: storing app injector'); AppInjector.setInjector(ref.injector); }) and then in the base component

Angular 6+ :ProvidedIn a non root module is causing a circular dependency

和自甴很熟 提交于 2019-11-30 21:29:13
问题 I'm trying to provide a resolve service via the new providedIn attribute. This is a translations resolver which I use in a protected module: import { Injectable } from '@angular/core'; import { Observable , pipe } from 'rxjs'; import {map} from "rxjs/operators"; //This is causing: "WARNING in Circular dependency detected:" import {ProtectedModule} from "../../../protected/protected.module"; import { HttpHandlerService } from '../../http/http-handler.service'; @Injectable({ providedIn:

Angular 7 app getting CORS error from angular client

谁说我不能喝 提交于 2019-11-30 20:15:13
I have developed an angular 7 app with express backend. Express running on localhost:3000 and angular client is running on localhost:4200. In the server.js I have (not the entire code) const app = express(); // Enable CORS app.use(cors()); // Get our API routes const api = require('./api'); // Set our api routes app.use('/api', api); app.use(express.static(__dirname + '/dist/sfdc-event')); In the api.js file, I have router.get(‘/oauth2/login’) which redirects to https://example.com which sends an access token and authenticates the user (OAuth2 authentication). When I am calling the url http:/

How do I make select2 to work with Angular 7

坚强是说给别人听的谎言 提交于 2019-11-30 17:59:35
问题 Am trying to implement Select 2 into my Angular 7 project. I followed all the procedures to implement from github. But still its not working. It works when i present some static data into it. Its not populating the data from the webserver. Please share your ideas. Below is my code Html Code: <select2 [options]="areas" [settings]="{ width: '100%' }"></select2> <div *ngFor="let ar of areas"> <p>{{ar.Area_Name}}</p> </div> Component Code: import { Component } from '@angular/core'; import {

Angular 7 Component Inheritance using a global injector

淺唱寂寞╮ 提交于 2019-11-30 17:55:19
问题 I've been using the approach described in an MSDN blog post to simplify extending components without needing to provide all the dependencies in the super() call. However this has stopped working in Angular 7 with Typescript 3. So what's happening is that after bootstrapping, I'm trying to store the injector in a service and afterwards I try to retrieve it. platformBrowserDynamic().bootstrapModule(AppModule).then(ref => { // Store module's injector in the AppInjector class console.log(

Improving production build time for Angular 7 application

守給你的承諾、 提交于 2019-11-30 13:31:18
My application takes a very long time to build for production using ng build --prod Sometimes it even fails with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory Is there something I can do to reduce the build time? There are some things that can be done to reduce the build time. Increase the memory limit of the build process The build command is executed by node where a single process has a maximum memory limit of 1.76 GB on 64bit machines. It can be increased by adding the --max-old-space-size argument to the build command Since this