<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>Service - Bipon's Diary</title>
	<atom:link href="https://biponnotes.iglyphic.com/tag/service/feed/" rel="self" type="application/rss+xml" />
	<link>https://biponnotes.iglyphic.com</link>
	<description>Do good for others. It will come back in unexpected ways.</description>
	<lastBuildDate>Sat, 28 Dec 2019 23:32:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.10</generator>
<site xmlns="com-wordpress:feed-additions:1">168324471</site>	<item>
		<title>Wrapping third party service in Angular</title>
		<link>https://biponnotes.iglyphic.com/wrapping-third-party-service-in-angular/</link>
					<comments>https://biponnotes.iglyphic.com/wrapping-third-party-service-in-angular/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sat, 28 Dec 2019 23:31:59 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[Service]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=268</guid>

					<description><![CDATA[<p>Step 1: npm install toastr &#8211;save Step 2: import angular.json file toastr.min.css in styles and toastr.min.js in scripts Step 3: Add a click event before that create a common service (step 4) Step 4: create a service file toastr.service.ts into app/common folder</p>
<p>The post <a href="https://biponnotes.iglyphic.com/wrapping-third-party-service-in-angular/">Wrapping third party service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Step 1: npm install toastr &#8211;save</p>



<p>Step 2: import angular.json file toastr.min.css in styles and toastr.min.js in scripts</p>



<pre class="wp-block-code"><code> "styles": [
              "node_modules/toastr/build/toastr.min.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ],
"scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/toastr/build/toastr.min.js",              
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]</code></pre>



<p>Step 3: Add a click event before that create a common service (step 4)</p>



<pre class="wp-block-code"><code>import { EventService } from './shared/event.service';
import { Component, OnInit } from '@angular/core';
import { ToastrService } from '../common/toastr.service';

@Component({
    selector: "events-list",
    template: `
    &lt;div>
    &lt;h2>Upcoming Angular Evnets&lt;/h2>
        &lt;hr>
        &lt;div class="row">
            &lt;div class="col-md-5" *ngFor="let event of events">
                &lt;event-thumbnail (click)="handleThumbnailClick(event.name)"  [event]="event">&lt;/event-thumbnail>
            &lt;/div>
        &lt;/div>
    &lt;/div>
    `
})


export class EventListComponent implements OnInit{

    events: any[];

    constructor(private eventService: EventService, private toastr: ToastrService){
        
    }

    ngOnInit(){
        this.events = this.eventService.getEvents();
    }
    handleThumbnailClick(eventName){
        this.toastr.success(eventName);
    }

}</code></pre>



<p>Step 4: create a service file toastr.service.ts into app/common folder</p>



<pre class="wp-block-code"><code>import { Injectable } from '@angular/core';

declare let toastr:any;

@Injectable()
export class ToastrService{

    success(message: string, title?: string){
        toastr.success(message, title);
    }
    info(message: string, title?: string){
        toastr.info(message, title);
    }
    warning(message: string, title?: string){
        toastr.warning(message, title);
    }
    error(message: string, title?: string){
        toastr.error(message, title);
    }

}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/wrapping-third-party-service-in-angular/">Wrapping third party service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/wrapping-third-party-service-in-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">268</post-id>	</item>
		<item>
		<title>Creating your first service in Angular</title>
		<link>https://biponnotes.iglyphic.com/creating-your-first-service-in-angular/</link>
					<comments>https://biponnotes.iglyphic.com/creating-your-first-service-in-angular/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sat, 28 Dec 2019 22:57:13 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angularcore]]></category>
		<category><![CDATA[Service]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=264</guid>

					<description><![CDATA[<p>At first creating event.service.ts file into app/events/shared event.service.ts file import service file in app.module file Import service file and inject into event-list.component.ts event-thumbnail.component.ts file</p>
<p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-service-in-angular/">Creating your first service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>At first creating event.service.ts file into app/events/shared</p>



<p>event.service.ts file</p>



<pre class="wp-block-code"><code>import { Injectable } from '@angular/core';

@Injectable()
export class EventService{
    getEvents(){
        return EVENTS;
    }
}

const EVENTS = [
    {
      id: 1,
      name: 'Angular Connect',
      date: '9/26/2036',
      time: '10:00 am',
      price: 599.99,
      imageUrl: '/assets/images/angularconnect-shield.png',
      onlineUrl: 'http://google.com',
      sessions: [
        {
          id: 1,
          name: "Using Angular 4 Pipes",
          presenter: "Peter Bacon Darwin",
          duration: 1,
          level: "Intermediate",
          abstract: `Learn all about the new pipes in Angular 4, both 
          how to write them, and how to get the new AI CLI to write 
          them for you. Given by the famous PBD, president of Angular 
          University (formerly Oxford University)`,
          voters: ['bradgreen', 'igorminar', 'martinfowler']
        },
        {
          id: 2,
          name: "Getting the most out of your dev team",
          presenter: "Jeff Cross",
          duration: 1,
          level: "Intermediate",
          abstract: `We all know that our dev teams work hard, but with 
          the right management they can be even more productive, without 
          overworking them. In this session I'll show you how to get the 
          best results from the talent you already have on staff.`,
          voters: ['johnpapa', 'bradgreen', 'igorminar', 'martinfowler']
        },
        {
          id: 3,
          name: "Angular 4 Performance Metrics",
          presenter: "Rob Wormald",
          duration: 2,
          level: "Advanced",
          abstract: `Angular 4 Performance is hot. In this session, we'll see 
          how Angular gets such great performance by preloading data on 
          your users devices before they even hit your site using the 
          new predictive algorithms and thought reading software 
          built into Angular 4.`,
          voters: []
        },
        {
          id: 4,
          name: "Angular 5 Look Ahead",
          presenter: "Brad Green",
          duration: 2,
          level: "Advanced",
          abstract: `Even though Angular 5 is still 6 years away, we all want 
          to know all about it so that we can spend endless hours in meetings 
          debating if we should use Angular 4 or not. This talk will look at 
          Angular 6 even though no code has yet been written for it. We'll 
          look at what it might do, and how to convince your manager to 
          hold off on any new apps until it's released`,
          voters: []
        },
        {
          id: 5,
          name: "Basics of Angular 4",
          presenter: "John Papa",
          duration: 2,
          level: "Beginner",
          abstract: `It's time to learn the basics of Angular 4. This talk 
          will give you everything you need to know about Angular 4 to 
          get started with it today and be building UI's for your self 
          driving cars and butler-bots in no time.`,
          voters: ['bradgreen', 'igorminar']
        }
      ]
    },
    {
      id: 2,
      name: 'ng-nl',
      date: '4/15/2037',
      time: '9:00 am',
      price: 950.00,
      imageUrl: '/assets/images/ng-nl.png',
      onlineUrl: 'http://google.com',
      location: {
        address: 'The NG-NL Convention Center &amp; Scuba Shop',
        city: 'Amsterdam',
        country: 'Netherlands'
      },
      sessions: [
        {
          id: 1,
          name: "Testing Angular 4 Workshop",
          presenter: "Pascal Precht &amp; Christoph Bergdorf",
          duration: 4,
          level: "Beginner",
          abstract: `In this 6 hour workshop you will learn not only how to test Angular 4, 
          you will also learn how to make the most of your team's efforts. Other topics
          will be convincing your manager that testing is a good idea, and using the new
          protractor tool for end to end testing.`,
          voters: ['bradgreen', 'igorminar']
        },
        {
          id: 2,
          name: "Angular 4 and Firebase",
          presenter: "David East",
          duration: 3,
          level: "Intermediate",
          abstract: `In this workshop, David East will show you how to use Angular with the new
          ultra-real-time 5D Firebase back end, hosting platform, and wine recommendation engine.`,
          voters: ['bradgreen', 'igorminar', 'johnpapa']
        },
        {
          id: 3,
          name: "Reading the Angular 4 Source",
          presenter: "Patrick Stapleton",
          duration: 2,
          level: "Intermediate",
          abstract: `Angular 4's source code may be over 25 million lines of code, but it's really 
          a lot easier to read and understand then you may think. Patrick Stapleton will talk
          about his secretes for keeping up with the changes, and navigating around the code.`,
          voters: ['martinfowler']
        },
        {
          id: 4,
          name: "Hail to the Lukas",
          presenter: "Lukas Ruebbelke",
          duration: 1,
          level: "Beginner",
          abstract: `In this session, Lukas will present the 
          secret to being awesome, and how he became the President 
          of the United States through his amazing programming skills, 
          showing how you too can be success with just attitude.`, 
          voters: ['bradgreen']
        },
      ]
    },
    {
      id: 3,
      name: 'ng-conf 2037',
      date: '5/4/2037',
      time: '10:00 am',
      price: 759.00,
      imageUrl: '/assets/images/ng-conf.png',
      location: {
        address: 'The Palatial America Hotel',
        city: 'Salt Lake City',
        country: 'USA'
      },
      sessions: [
        {
          id: 1,
          name: "How Elm Powers Angular 4",
          presenter: "Murphy Randle",
          duration: 2,
          level: "Intermediate",
          abstract: `We all know that Angular is written in Elm, but did you
          know how the source code is really written? In this exciting look
          into the internals of Angular 4, we'll see exactly how Elm powers
          the framework, and what you can do to take advantage of this knowledge.`,
          voters: ['bradgreen', 'martinfowler', 'igorminar']
        },
        {
          id: 2,
          name: "Angular and React together",
          presenter: "Jamison Dance",
          duration: 2,
          level: "Intermediate",
          abstract: `React v449.6 has just been released. Let's see how to use 
          this new version with Angular to create even more impressive applications.`,
          voters: ['bradgreen', 'martinfowler']
        },
        {
          id: 3,
          name: "Redux Woes",
          presenter: "Rob Wormald",
          duration: 1,
          level: "Intermediate",
          abstract: `Everyone is using Redux for everything from Angular to React to 
          Excel macros, but you're still having trouble grasping it? We'll take a look
          at how farmers use Redux when harvesting grain as a great introduction to 
          this game changing technology.`,
          voters: ['bradgreen', 'martinfowler', 'johnpapa']
        },
        {
          id: 4,
          name: "ng-wat again!!",
          presenter: "Shai Reznik",
          duration: 1,
          level: "Beginner",
          abstract: `Let's take a look at some of the stranger pieces of Angular 4,
          including neural net nets, Android in Androids, and using pipes with actual pipes.`,
          voters: ['bradgreen', 'martinfowler', 'igorminar', 'johnpapa']
        },
        {
          id: 5,
          name: "Dressed for Success",
          presenter: "Ward Bell",
          duration: 2,
          level: "Beginner",
          abstract: `Being a developer in 2037 is about more than just writing bug-free code. 
          You also have to look the part. In this amazing expose, Ward will talk you through
          how to pick out the right clothes to make your coworkers and boss not only
          respect you, but also want to be your buddy.`,
          voters: ['bradgreen', 'martinfowler']
        },
        {
          id: 6,
          name: "These aren't the directives you're looking for",
          presenter: "John Papa",
          duration: 2,
          level: "Intermediate",
          abstract: `Coinciding with the release of Star Wars Episode 18, this talk will show how
          to use directives in your Angular 4 development while drawing lessons from the new movie,
          featuring all your favorite characters like Han Solo's ghost and Darth Jar Jar.`,
          voters: ['bradgreen', 'martinfowler']
        },
      ]
    },
    {
      id: 4,
      name: 'UN Angular Summit',
      date: '6/10/2037',
      time: '8:00 am',
      price: 800.00,
      imageUrl: '/assets/images/basic-shield.png',
      location: {
        address: 'The UN Angular Center',
        city: 'New York',
        country: 'USA'
      },
      sessions: [
        {
          id: 1,
          name: "Diversity in Tech",
          presenter: "Sir Dave Smith",
          duration: 2,
          level: "Beginner",
          abstract: `Yes, we all work with cyborgs and androids and Martians, but 
          we probably don't realize that sometimes our internal biases can make it difficult for
          these well-designed coworkers to really feel at home coding alongside us. This talk will
          look at things we can do to recognize our biases and counteract them.`,
          voters: ['bradgreen', 'igorminar']
        },
        {
          id: 2,
          name: "World Peace and Angular",
          presenter: "US Secretary of State Zach Galifianakis",
          duration: 2,
          level: "Beginner",
          abstract: `Angular has been used in most of the major peace brokering that has
          happened in the last decade, but there is still much we can do to remove all
          war from the world, and Angular will be a key part of that effort.`,
          voters: ['bradgreen', 'igorminar', 'johnpapa']
        },
        {
          id: 3,
          name: "Using Angular with Androids",
          presenter: "Dan Wahlin",
          duration: 3,
          level: "Advanced",
          abstract: `Androids may do everything for us now, allowing us to spend all day playing 
          the latest Destiny DLC, but we can still improve the massages they give and the handmade
          brie they make using Angular 4. This session will show you how.`,
          voters: ['igorminar', 'johnpapa']
        },
      ]
    },
    {
      id: 5,
      name: 'ng-vegas',
      date: '2/10/2037',
      time: '9:00 am',
      price: 400.00,
      imageUrl: '/assets/images/ng-vegas.png',
      location: {
        address: 'The Excalibur',
        city: 'Las Vegas',
        country: 'USA'
      },
      sessions: [
        {
          id: 1,
          name: "Gambling with Angular",
          presenter: "John Papa",
          duration: 1,
          level: "Intermediate",
          abstract: `No, this talk isn't about slot machines. We all know that 
          Angular is used in most waiter-bots and coke vending machines, but
          did you know that was also used to write the core engine in the majority
          of voting machines? This talk will look at how all presidential elections
          are now determined by Angular code.`,
          voters: ['bradgreen', 'igorminar']
        },
        {
          id: 2,
          name: "Angular 4 in 60ish Minutes",
          presenter: "Dan Wahlin",
          duration: 2,
          level: "Beginner",
          abstract: `Get the skinny on Angular 4 for anyone new to this great new technology.
          Dan Wahlin will show you how you can get started with Angular in 60ish minutes, 
          guaranteed!`,
          voters: ['bradgreen', 'igorminar', 'johnpapa']
        }
      ]
    }
  ]</code></pre>



<p>import service file in app.module file</p>



<pre class="wp-block-code"><code>import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { EventsAppComponent } from './events-app.component';
import { EventListComponent } from './events/event-list.component';
import { EventThumbnailComponent } from './events/event-thumbnail.component';
import { NavBarComponent } from './nav/navbar-component';
import { EventService } from './events/shared/event.service';

@NgModule({
  declarations: [
    EventsAppComponent,
    EventListComponent,
    EventThumbnailComponent,
    NavBarComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [EventService],
  bootstrap: [EventsAppComponent]
})
export class AppModule { }</code></pre>



<p>Import service file and inject  into  event-list.component.ts </p>



<pre class="wp-block-code"><code>import { EventService } from './shared/event.service';
import { Component, OnInit } from '@angular/core';

@Component({
    selector: "events-list",
    template: `
    &lt;div>
    &lt;h2>Upcoming Angular Evnets&lt;/h2>
        &lt;hr>
        &lt;div class="row">
            &lt;div class="col-md-5" *ngFor="let event of events">
                &lt;event-thumbnail  [event]="event">&lt;/event-thumbnail>
            &lt;/div>
        &lt;/div>
    &lt;/div>
    `
})


export class EventListComponent implements OnInit{

    events: any[];

    constructor(private eventService: EventService){
        
    }

    ngOnInit(){
        this.events = this.eventService.getEvents();
    }

}</code></pre>



<figure class="wp-block-image"><img width="690" height="260" src="https://i1.wp.com/bipon.me/wp-content/uploads/2019/12/creating-service.png?resize=690%2C260&#038;ssl=1" alt="" class="wp-image-265" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2019/12/creating-service.png?w=690&amp;ssl=1 690w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2019/12/creating-service.png?resize=300%2C113&amp;ssl=1 300w" sizes="(max-width: 690px) 100vw, 690px" data-recalc-dims="1" /></figure>



<p>event-thumbnail.component.ts file</p>



<pre class="wp-block-code"><code>import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
    selector: 'event-thumbnail',
    template: `        
        &lt;div class="well thumbnail">
            &lt;h2>{{event?.name}}&lt;/h2>
            &lt;div>Date: {{event?.date}}&lt;/div>
            &lt;div [ngStyle]="getStartTimeStyle()" 
            [ngSwitch]="event?.time">
                Time: {{event?.time}}
                &lt;span *ngSwitchCase="'8:00 am'">(Early Start)&lt;/span>
                &lt;span *ngSwitchCase="'10:00 am'">(Late Start)&lt;/span>
                &lt;span *ngSwitchDefault>(Normal Start)&lt;/span>
            &lt;/div>
            &lt;div>price: \${{event?.price}}&lt;/div>
            &lt;!-- &lt;div>time: {{event?.time}}&lt;/div> -->
            &lt;div *ngIf="event?.location">
                &lt;span>Location: {{event?.location?.address}}&lt;/span>
                &lt;span>&nbsp;&lt;/span>
                &lt;span>{{event?.location?.city}}, {{event?.location?.country}}&lt;/span>
            &lt;/div>
            &lt;div *ngIf="event?.onlineUrl">
                Online Url: {{event?.onlineUrl}}
            &lt;/div>
            
        &lt;/div>

    `,
    styles : [`
        .green{color: green !important}
        .bold{font-weight: bold;}
        .thumbnail{min-height: 210px;}
    `]
})

export class EventThumbnailComponent{
    @Input() event: any;

    getStartTimeStyle():any{
        if(this.event &amp;&amp; this.event.time === '8:00 am')
            return {color: '#003300', 'font-weight': 'bold'}
        return {}
    }
}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-service-in-angular/">Creating your first service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/creating-your-first-service-in-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">264</post-id>	</item>
		<item>
		<title>Retrieving data for Select elements</title>
		<link>https://biponnotes.iglyphic.com/retrieving-data-for-select-elements/</link>
					<comments>https://biponnotes.iglyphic.com/retrieving-data-for-select-elements/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 12 Dec 2019 06:28:50 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angularcore]]></category>
		<category><![CDATA[Service]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=176</guid>

					<description><![CDATA[<p>Step 1: user-settings-form.component.ts file Step 2: data.service.ts file Step 3: user-settings-form.component.html file</p>
<p>The post <a href="https://biponnotes.iglyphic.com/retrieving-data-for-select-elements/">Retrieving data for Select elements</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Step 1</strong>: user-settings-form.component.ts file</p>



<pre class="wp-block-code"><code>import { Observable } from 'rxjs';

//subscriptionTypes = ['one', 'two', 'three']
subscriptionTypes$: Observable&lt;string[]>

 ngOnInit() {
    this.subscriptionTypes$ = this.dataService.getSubscriptionTypes();
  }
</code></pre>



<p><strong>Step 2:</strong> data.service.ts file</p>



<pre class="wp-block-code"><code>import { Observable, of } from 'rxjs';

 getSubscriptionTypes(): Observable&lt;string[]>{
    return of(['Monthly', 'Annual', 'Lifetime']);
  }
</code></pre>



<p><strong>Step 3:</strong> user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;div class="form-group">
        &lt;label for="subscriptionType">Subscription Type&lt;/label>
        &lt;select class="form-control" id="subscriptionType" 
           name="subscriptionType" [(ngModel)]="userSettings.subscriptionType">
                &lt;option *ngFor="let type of subscriptionTypes$ | async">
                        {{type}}
                &lt;/option>
        &lt;/select>
    &lt;/div>
</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/retrieving-data-for-select-elements/">Retrieving data for Select elements</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/retrieving-data-for-select-elements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">176</post-id>	</item>
		<item>
		<title>Creating a Service in Angular</title>
		<link>https://biponnotes.iglyphic.com/creating-a-service-in-angular/</link>
					<comments>https://biponnotes.iglyphic.com/creating-a-service-in-angular/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 12 Dec 2019 04:44:23 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angularcore]]></category>
		<category><![CDATA[Service]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=170</guid>

					<description><![CDATA[<p>Step 1: create a data-service.ts file in data folder Note: ng command &#8211; ng g s data import user-settings file Step 2: in user-settings-form.component.ts file import bellow those two files Step 3: in user-settings-form.component.html file {{userSettings &#124; json}}</p>
<p>The post <a href="https://biponnotes.iglyphic.com/creating-a-service-in-angular/">Creating a Service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Step 1</strong>: create a data-service.ts file in data folder<br> <strong>Note</strong>: ng command &#8211; ng g s data</p>



<p>import user-settings file</p>



<pre class="wp-block-code"><code>import { UserSettings } from './user-settings';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class DataService {
  constructor() { }

  postUserSettingsForm(userSettings: UserSettings): Observable&lt;any>{  
    return of(userSettings);
  }
} 
</code></pre>



<p><strong>Step 2</strong>:  <br> in user-settings-form.component.ts file<br> import bellow those two files</p>



<pre class="wp-block-code"><code>import { DataService } from './../data/data.service';
import { UserSettings } from './../data/user-settings';

constructor(private dataService: DataService) { }
  onSubmit(form: NgForm){
    console.log('in onSubmmit: ', form.value);
       this.dataService.postUserSettingsForm(this.userSettings).subscribe(
         result => console.log('success: ', result),
         error => console.log('error: ', error)
       );
  }
</code></pre>



<p>Step 3: in user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" (ngSubmit)="onSubmit(form)">
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control" [(ngModel)]="userSettings.name" />
    &lt;/div>
&lt;/form></code></pre>



<p>{{userSettings | json}}</p><p>The post <a href="https://biponnotes.iglyphic.com/creating-a-service-in-angular/">Creating a Service in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/creating-a-service-in-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">170</post-id>	</item>
	</channel>
</rss>
