This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { Meta } from '@angular/platform-browser'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './home.html', | |
| }) | |
| export class HomeComponent { | |
| constructor(private meta: Meta) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { Meta } from '@angular/platform-browser'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './home.html', | |
| }) | |
| export class HomeComponent { | |
| constructor(private meta: Meta) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { Meta } from '@angular/platform-browser'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './home.html', | |
| }) | |
| export class HomeComponent { | |
| constructor(private meta: Meta) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { Meta } from '@angular/platform-browser'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './home.html', | |
| }) | |
| export class HomeComponent { | |
| constructor(private meta: Meta) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.meta.addTag({ name: 'description', content: 'How to use Angular 4 meta service' }); | |
| this.meta.updateTag({ name: 'description', content: 'Angular 4 meta service' }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.meta.addTag({ name: 'author', content: 'talkingdotnet' }); | |
| this.meta.removeTag('name="author"'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.meta.addTag({ name: 'author', content: 'talkingdotnet' }); | |
| const author = this.meta.getTag('name=author'); | |
| this.meta.removeTagElement(author); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddMvc(); | |
| services.AddSwaggerGen(c => | |
| { | |
| c.SwaggerDoc("v1", new Info | |
| { | |
| Version = "v1", | |
| Title = "My API", | |
| Description = "My First ASP.NET Core Web API", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
| { | |
| if (env.IsDevelopment()) | |
| { | |
| app.UseDeveloperExceptionPage(); | |
| } | |
| app.UseMvc(); | |
| app.UseSwagger(); | |
| app.UseSwaggerUI(c => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.UseSwaggerUI(c => | |
| { | |
| c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); | |
| c.SwaggerEndpoint("/swagger/v2/swagger.json", "My API V2"); | |
| } |