angular6

CustomeDateAdapter in Angular Material 6

怎甘沉沦 提交于 2019-12-12 11:46:27
问题 I have implemented a CustomDateAdapter as described here: https://medium.com/@esanjiv/working-with-custom-dateadapter-for-angular-material-2-datepicker-76d4446277dc Now, I am doing the Angular Material 6 migration and I get the following error core.js:1598 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'TRIDENT' of undefined TypeError: Cannot read property 'TRIDENT' of undefined at CustomDateAdapter.NativeDateAdapter [as constructor] (core.es5.js:792) at new

How to call an angular 6 function from browser console?

风流意气都作罢 提交于 2019-12-12 11:41:10
问题 I want to call a function that is inside a component from the browser console. I want something like this but equivalent to angular 6. Thank you in advance 回答1: Yes you can check by below method.. on your google chrome console, you can run below command ng.probe($0).componentInstance.<name of function you want to run from component.ts file> You can check the output. Do let me know if you need further clarification. Please check reference for better understanding. 来源: https://stackoverflow.com

Angular 6 Unit Test ngOnInit with a setTimeOut not working

蹲街弑〆低调 提交于 2019-12-12 10:21:27
问题 I have a component with a setTimeOut function inside a ngOnInit function. To write unit test cases for that I'm using tick and fakeAsync to fast forward the setTimeOut. But, it's not getting executed which in turn is not calling other function closeAlert(). Component code: export class BannerComponent implements OnInit { @Input()errorData: any; @Input()callback: any; @Input()autoHide: boolean; constructor() { } ngOnInit() { if (this.autoHide) { setTimeout (() => { this.closeAlert(); }, 500);

angular7 input type file upload not working

孤人 提交于 2019-12-12 09:54:17
问题 Present i'm working angular angular 7 input type="file" not working. Angular6 its working fine. angular 6 submit the input file type data i will get field list like this But angular 7 only get image path like this. only i updated angular 6 to angular 7 i will get this error. what is the issue i don't know. Thanks , 回答1: I have a upload document section in my Angular7 app, here is working example: example.component.html <form [formGroup]="form"> <div class="form-group"> <label>Select file to

Angular 6 - No 'Access-Control-Allow-Origin' header is present on the requested resource

China☆狼群 提交于 2019-12-12 09:01:21
问题 I have an Angular 6 project, which has a service with is pointing to a server.js Angular is on port: 4200 and Server.js is on port: 3000. When I point the service to http://localhost:3000/api/posts (Server.js location), I'm getting this error: Failed to load http://localhost:3000/api/posts: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. Here is the server.js code: // Get dependencies const express =

How to Upload multiple files in Angular 6 with ADDMORE button?

南楼画角 提交于 2019-12-12 08:16:06
问题 Hello, Everone. I've been trying to Upload above(image) use case. I know it is very easy when we have a single file. but now the scenario is different it consists of an array of objects with the file. Now my question is how can I render the formdata object with the array of objects where each object consists of a file. For dynamic form, I used angular reactive forms. Can anyone please suggest me how can send whole data to the backed with the single click on save button. For backend I used

How to create angular 5 project in angular cli 6.0.1

孤人 提交于 2019-12-12 07:12:44
问题 My angular cli version is 6.0.1 and node version is 8.11.1 . How to create or add a new project of angular 5. If I use ng new [project_name] then the project is downloading that is of angular 6 . 回答1: I stumbled upon this scenario too. Here is my solution to it. Unfortunately we are at the CLI's mercy, as the best way to create a new Angular project scaffolding. Considering ng new {app_name} does not support a version flag. Our aim would be to get the right CLI version installed. The

I am getting Data in Console Using Angular but I can't render it in html

北城余情 提交于 2019-12-12 06:45:32
问题 This is my Page-datail.component.ts export class PageDetailComponent implements OnInit { private apiUrl="http://localhost:3000/pages" pages={}; // data={}; constructor(private route:ActivatedRoute,private page:PageService,private router: Router,private http:Http) { } ngOnInit() { this.getpage(this.route.snapshot.params['title']); // this.getPages(); // this.getData(); } getpage(title) { this.page.getPage(title) .subscribe(pages => { console.log(pages); this.pages = pages; }, err => { console

Angular 6 vendor and main js scripting size decrease

谁都会走 提交于 2019-12-12 01:16:03
问题 I'm using angular 6+ while npm start project in local system it's take above 12 seconds to perform application . When initial load page vendor and main js file size too big so how could I reduce size?. 1.I tried to remove style in my html code. 2. Removed un-necessary import class.(Angular) Package.json: / "devDependencies": { "@angular-devkit/build-angular": "^0.8.8", "@angular/cli": "^6.2.8", "@angular/compiler-cli": "^6.1.0", "@angular/language-service": "^6.1.0", "@types/jasmine": "^2.8

Calendar don't show events in first load, only after trigger any element in window

不打扰是莪最后的温柔 提交于 2019-12-11 20:05:36
问题 Calendar don't show events in first load. Only when I trigger any event like click in button to change the view from month to week for example. I'm using Angular Calendar 6 + LINK My project is made in Angular 6 . The calendar don't show data in first load, only after it when I trigger any event. Everything is working as expected, so Ill give the Html (part of them) and the most important: the most important in this case. HTML ... <div [ngSwitch]="view"> <mwl-calendar-month-view *ngSwitchCase