angular6

Angular 6 - <a> href gets appended to base url

牧云@^-^@ 提交于 2019-12-18 09:08:37
问题 I have a list of users displayed in the table and each users has link which is displayed and can be navigated to. <div class="inline-icon-text"> <small class="text-muted d-md-none mr-3">Link</small> <a [attr.href]="candidate.url" target="_blank" [title]="candidate.url"> <i class="material-icons">open_in_new</i> </a> </div> Problem is, when I inspect link element it points to correct address but after clicking on it gets appended to app base url. <a _ngcontent-c15="" target="_blank" href="www

Development Server hot updates not working

扶醉桌前 提交于 2019-12-18 05:48:27
问题 I upgraded my .NET Core 2.1 project to Angular 6 and everything seems to be working correctly except for hot-updates. Before updating it was possible to update the TypeScript and VS would re-compile and reload the browser, now that seems to be broken along with having to manually run ng build to recompile the scripts, VS doesn't seem to recompile automatically anymore. Is there a setting, possibly in angular.json that I need to set to enable the development server? Update For some reason, Hot

Update to Angular v6 - Module not found: Error: Can't resolve 'fs'

最后都变了- 提交于 2019-12-18 04:38:11
问题 I'm trying to migrate my Angular Universal project from Angular v5 to v6 I've got a service where I use fs to load the translation on the server side. Everything works well with Angular v5. With Angular v6, when I run npm run start aka ng serve --proxy-config proxy.conf.json I face the following error ERROR in ./src/providers/core/translate/translate-universal-loader.service.ts Module not found: Error: Can't resolve 'fs' in '/Users/me/Documents/projects/myproject/src/providers/core/translate'

Fill custom SVG image using percentage value

╄→尐↘猪︶ㄣ 提交于 2019-12-18 04:27:10
问题 I want to fill the custom SVG image with percentage value in Angular 6 using typescript or using CSS. Is there any tool available for that? Custom image can be anything like $, gear icon, thumb etc. Any help would be appreciated. 回答1: The simplest method is probably with a linear gradient. function setProgress(amt) { amt = (amt < 0) ? 0 : (amt > 1) ? 1 : amt; document.getElementById("stop1").setAttribute("offset", amt); document.getElementById("stop2").setAttribute("offset", amt); }

Angular 6 - run method is service every 10 seconds

跟風遠走 提交于 2019-12-17 22:56:05
问题 I have this service using HttpClient to get some data : checkData() { return this.http.get('my url'); } The on the footer component I call it and display the result : ngOnInit() { this.myservice.checkdata().subscribe( result => { this.statustext = result } ); } This works, but I need this method to be run every 10 seconds so it's up to date. How can I do this? 回答1: Use rxjs timer to call the api request at startup and then every 10s. This is best achieved by using rxjs to divide and conquer.

how to use jquery-ui in angular 6

心不动则不痛 提交于 2019-12-17 20:19:41
问题 I have tried number of methods posted on StackOverflow to use jquery-ui in angular 6 component but none of them worked. For example, I ran npm install jquery jquery-ui to install jquery and jquery-ui. Included following in angular.json "scripts": [ "node_modules/jquery/dist/jquery.js", "node_modules/jquery-ui-dist/jquery-ui.js", Error is as follows: AppComponent_Host.ngfactory.js [sm]:1ERROR TypeError: jquery__WEBPACK_IMPORTED_MODULE_1__(...).slider is not a function at AppComponent.push..

Alternative to /deep/

陌路散爱 提交于 2019-12-17 19:22:05
问题 I want to change the styles of ng bootstrap pagination component and using /deep/ links in an Angular 6 app. The following code works fine but the console is showing a warning that the code is deprecated. So, how should I change it to get rid of the warning? Here is the CSS code I am currently using: ngb-pagination /deep/ .page-item.disabled .page-link{ background: none; } ngb-pagination /deep/ .page-item.active .page-link { background-color: #223C61; &:focus, &:visited{ outline: none; box

Cannot find module 'webpack' - Angular

眉间皱痕 提交于 2019-12-17 18:26:37
问题 I just migrated my project from angular v5.x to v6.x and now when I try to start it with ng serve I'm getting: Cannot find module 'webpack' Error: Cannot find module 'webpack' at Function.Module.... any help ? I cleared node modules and: npm cache clean --force npm install npm install --save-dev @angular/cli@latest but that didn't help 回答1: I had the same issue and this worked for me: Delete these files/ folders (from your Angular root folder): package-lock.json ( Not the package.json) /node

Angular 6 does not add X-XSRF-TOKEN header to http request

有些话、适合烂在心里 提交于 2019-12-17 18:18:54
问题 I've read the docs and all the related questions on SO, but still Angular's XSRF mechanism isn't working for me: in no way I can make a POST request with the X-XSRF-TOKEN header appended automatically. I have an Angular 6 app with a login form. It's part of a Symfony (PHP 7.1) website, and the Angular app page, when served from Symfony, sends the correct Cookie ( XSRF-TOKEN ): My app.module.ts includes the right modules: // other imports... import {HttpClientModule, HttpClientXsrfModule} from

Angular 6 many Can't resolve errors (crypto, fs, http, https, net, path, stream, tls, zlib)

不打扰是莪最后的温柔 提交于 2019-12-17 07:14:28
问题 I'm building an Angular 6 app, but every time I want to serve to localhost, I get these errors: ERROR in ./node_modules/aws-sign2/index.js Module not found: Error: Can't resolve 'crypto' in 'C:\Users\sorou\projects\tunrWeb\node_modules\aws-sign2' ERROR in ./node_modules/aws4/aws4.js Module not found: Error: Can't resolve 'crypto' in 'C:\Users\sorou\projects\tunrWeb\node_modules\aws4' ERROR in ./node_modules/ecc-jsbn/index.js Module not found: Error: Can't resolve 'crypto' in 'C:\Users\sorou