angular6

Deploy and host .net core 2.0 and angular 6 app

北城以北 提交于 2019-12-24 05:05:34
问题 Intro: Currently, I have two separate projects. One solution is for .NET core Web API 2.0 and another project is Angular 6 app. I have a problem deploying this to my hosting provider ( asphostsportal ). It consists of one root folder httpdocs where when I publish my API I copy contents of publishing folder. After transferring files via FTP I confirm that my API works by sending a request and getting the response. Now I need to publish my angular project. The simplest way to do so is with ng

angular add unsafe before url in href - sanitizing unsafe URL

試著忘記壹切 提交于 2019-12-24 03:59:23
问题 I am trying to open an app. Its working fine when I give a static URL. But as I create a dynamic href tag in *ngFor I can see unsafe keyword is added before the URL and it's not working. I am running on Angular 6. And getting the Id in a service. In ngFor I am looping the result and creating a link with Id to open the app. I create a pipe but it's still not working. Safe Pipe import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; @Pipe({

how to run angular 6 app with nodejs api on production?

可紊 提交于 2019-12-24 03:37:45
问题 Hi I am new to angular6 In development mode I have worked in angular 4200 port and node in different port (8080) in my operations. but now I want to move my app into production mode. for that I had build my angular project by using ng build command. after i get a dist folder is created on the root folder. so i went to server.js file here I had add my static file app.use(express.static(path.join(__dirname,'dist/MDProject'))); app.use('/',(req,res)=>{ res.sendFile(path.join(__dirname,'dist

Angular 6 vendor and main js taking too much time to load the data

拜拜、爱过 提交于 2019-12-24 03:35:20
问题 I dont understand why in my project scripting is taking too much time to load the page. It look like angular 6 is taking time in loading css and js from assest folder as well its taking time to load vendor and main js. I dont understand why its happening. below is my routing file import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './app.component'; import { LoginComponent } from './login/login.component'; import {

Angular - mat-grid-list not displaying children passed by <ng-content>

人走茶凉 提交于 2019-12-24 01:13:22
问题 I'm using angular material design components and want to create a custom grid-list component. The component would adapt the number of grid-list-columns based on its size. The components template would look like this: <mat-grid-list [cols]="adaptiveCols"> <ng-content></ng-content> </mat-grid-list> And the component will be used like this: <my-grid> <mat-grid-tile>tile_content</mat-grid-tile> <mat-grid-tile>tile_content</mat-grid-tile> <mat-grid-tile>tile_content</mat-grid-tile> </my-grid> So

unable to test Routing using RouterTestingModule

亡梦爱人 提交于 2019-12-24 00:36:11
问题 I have a component which uses Routes . I want to unit test the routes but am unale to do so using RouterTestingModule . The spec I have written is import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; .... fdescribe('HomepageContentComponentComponent', () => { let component: HomepageContentComponentComponent; let fixture: ComponentFixture<HomepageContentComponentComponent>; beforeEach(() => { TestBed.configureTestingModule({ imports:[ RouterTestingModule

Run ng build with custom configurations

可紊 提交于 2019-12-24 00:25:29
问题 I have Angular project which I would like to deploy on Apache server. I use ng build but I would like to custom address and endpoint for backend. proxy.conf.json: { "/api/*": { "target": "http://localhost:8080", "secure": false, "logLevel": "debug", "changeOrigin": true } } This configuration is not applied at all. How I can set it properly in order to change configurations? Environment ts file: import {environment as prod} from './environment.prod'; export const environment = Object.assign

How to get a screen resize dimension from a service in angular 2+?

帅比萌擦擦* 提交于 2019-12-23 21:32:23
问题 First this not duplicated take time to read, because there is lot of similar question but they are in the @Component decorator I got the idea to catch screen resizing in a service then sharing some css value by an observable, but it seem that my service is not working (not able to catch screen resize event). Here is my code import { Injectable, HostListener } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root', }) export class BreakPointService {

Rxjs 6: using catchError() gives You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

瘦欲@ 提交于 2019-12-23 19:36:08
问题 I'm using the new syntax to comply with RxJS 6 pipe() . Also using Angular 6. I have a service that handles http requests, and it pipes map and catchError to display a toast in case of connection error. Nevertheless, If I add catchError I get in console You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. getDataHttpRequest(url, returnType) { return this.http.get(url, this.getRequestOptions()) .pipe( map((response) => { if(response)

Multiple Conditions in ngIf in Angular 6

给你一囗甜甜゛ 提交于 2019-12-23 19:33:34
问题 I want to hide one div and want to show another for that I have written below code My Code My problem is I have used multiple conditions in ngIf but not working properly. Once I click on "Show sub content1" want to hide main content and want to show "Sub Content 1" and vise versa for all buttons. What should I do for this. Please help. 回答1: Your were just near to your result and looking into your code looks like you are learning, Good Work!! you have to check just if any one of the content is