angular6

Convert XML RSS feed to Json on Angular app

血红的双手。 提交于 2019-12-04 17:19:35
I have an API like this https://blog.com/rss . It returns below xml as blog feed. Note: I have seen this. But it is for nodejs app. https://github.com/nasa8x/rss-to-json So can you tell me how can I retrieve the image , title , date and the description from it? i.e. Json output from it. After that I need to show that on the html page like so: Note: This is just one node. It'll have many nodes according to the feed output. i.e. ngFor loop .html <div class="card"> <div class="card-wrapper"> <img class="card-img-top" src="../../../assets/img/blog-1.png" alt="Card image cap"> <div class="card-body

Angular/RxJS 6: How to prevent duplicate HTTP requests?

旧时模样 提交于 2019-12-04 17:02:29
问题 Currently have a scenario where a method within a shared service is used by multiple components. This method makes an HTTP call to an endpoint that will always have the same response and returns an Observable. Is it possible to share the first response with all subscribers to prevent duplicate HTTP requests? Below is a simplified version of the scenario described above: class SharedService { constructor(private http: HttpClient) {} getSomeData(): Observable<any> { return this.http.get<any>(

How to keep observable alive after error in RxJS 6 and Angular 6

 ̄綄美尐妖づ 提交于 2019-12-04 15:50:35
Can anyone help with the scenario where this._getReactions$.next() not working whenever this.http.get(...) gets an error. I want to keep observable alive to take the next input. private _getReactions$: Subject<any> = new Subject(); constructor() { this._getReactions$ .pipe( switchMap(() => { return this.http.get(...) // http request }), catchError(error => { console.log(error); return empty(); }) ) .subscribe(data => { console.log(data) //results handling }); } onClick() { this._getReactions$.next(); } If observable dies it calls it error handler and they are closed you can't send anything

Generating Components without *.spec.ts in Angular 6

岁酱吖の 提交于 2019-12-04 15:12:37
In previous version, spec.ts can be disabled with .angular-cli.json as below. Is there any way to do it with angular.json in version 6.0.0? "defaults": { "component": { "spec": false }, "service": { "spec": false }, ... } Chanuka Asanka in version "6.0.0" *.spec.ts can be disabled with angular.json NOTE: don't forget to change the "prefix" property values "fmyp" and "fmp" to yours. "schematics": { "@schematics/angular:component": { "prefix": "fmyp", "styleext": "css", "spec": false }, "@schematics/angular:directive": { "prefix": "fmp", "spec": false }, "@schematics/angular:module": { "spec":

How to restrict Special character in material input

帅比萌擦擦* 提交于 2019-12-04 12:01:41
问题 I have a material input control, i have restrict the special character while user enter, but when type some words in any editor and copy and paste the words with special character, which is not working. I have write the directive for that to prevent special character,but can one provide the better solution restrict in copy paste. app.component.html: <form class="example-form"> <mat-form-field class="example-full-width"> <input matInput specialIsAlphaNumeric placeholder="Favorite food" value=

Angular 6 using angular2-jwt

我们两清 提交于 2019-12-04 11:09:17
After the migration of my app from Angular 4^ to Angular 6 (newest version) I got a very weird error in my Auth service. Specific, the angular2-jwt package is causing a killer error when I try to "serve" or "build" the app in production environment. In the other hand, the same code runs perfectly well on "dev" environment. OS -> MacOS 10.13.6 The error I got when execute ng serve --configuration production : ERROR in : Error: Internal error: unknown identifier [{"filePath":"/Users/paulo/Projects/eleo-usuario/node_modules/angular2-jwt/angular2-jwt.d.ts","name":"AuthHttp","members":[]},{

Golden Layout with Angular 6 using typescript?

六月ゝ 毕业季﹏ 提交于 2019-12-04 10:01:00
I am using golden layout with Angular 6, following this tutorial . I'm getting an error on GoldenLayoutModule.forRoot(config) config not assignable to parameter of type GoldenLayoutConfiguration . import { AppComponent } from './app.component'; import { GoldenLayoutModule, GoldenLayoutConfiguration } from '@embedded-enterprises/ng6-golden-layout'; import * as $ from 'jquery'; // It is required to have JQuery as global in the window object. window['$'] = $; // const config: GoldenLayoutConfiguration { /* TODO */ }; let config = { content: [{ type: 'row', content:[{ type: 'component',

Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'site-notice'

社会主义新天地 提交于 2019-12-04 09:57:42
Im totaly confused about this error. I have a very basic simple routing: const routes: Routes = [ { path: '', component: FrameDefaultComponent, pathMatch: 'full', children: [ {path: '', component: SiteCalculatorComponent}, {path: 'site-notice', component: SiteSiteNoticeComponent} ] }, ]; When i click the menu entrie for site-notice in the menu that looks like this: menuEntries = [ { title: 'Calculator', url: '/' }, { title: 'Site Notice', url: '/site-notice' } ]; Then i get the following error: core.js:1521 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'site

Angular : Unable to pass API url in SignalR HubConnection

只谈情不闲聊 提交于 2019-12-04 09:34:16
I have developed a project in Angular6. There is a requirement to develop section for live chat. For that I am using SignalR in my asp.net core Web Apiproject. Now I want to use this Web Api reference in my Angular project. I am using this link. But while providing the Web Api url in App.Component.ts, I am getting below error : Constructor of class 'HubConnection' is private and only accessible within the class declaration. App Component.ts : import { HubConnection } from '@aspnet/signalr'; import { Message } from 'primeng/api'; export class AppComponent implements OnInit { public

ngx-translate not showing any text in lazy-loaded module

做~自己de王妃 提交于 2019-12-04 09:11:45
We are using Angular 6 in our application. We recently started to prepare our app fro lazy-loading. Application has multiple lazy-loaded routes. We want to use a single language file for all routes (don't need to separate it into chunks. But load all translations on bootstrap). First thing I tried was just to import and configure ngx-translate in AppModule (forRoot) and nowhere else. For that purpose I created a configuration file for TranslateModule with the following code: import { MissingTranslationHandler, MissingTranslationHandlerParams, TranslateLoader, TranslateModuleConfig } from '@ngx