-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed as not planned
Closed as not planned
Copy link
Labels
area: serverIssues related to server-side renderingIssues related to server-side renderingneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate further
Milestone
Description
Which @angular/* package(s) are the source of the bug?
platform-browser
Is this a regression?
Yes
Description
I am trying to add meta tags dynamically, i am able to see in inspect element, but view page source not displaying.
If i hardcode same metatags in service instead of taking from API it works. but if we take data from API and than try to set its not visible in View page source. (Same applies to dynamic content in page)
Here is little snap how i am setting meta tags
import { Title, Meta, MetaDefinition } from '@angular/platform-browser';
constructor(private seoService:SeoService,
private metaTagService: Meta){
}
ngOnInit(): void {
this.seoService.getResponse().subscribe((res:any)=>{
let tags: MetaDefinition[]=[];
for(let i=0;i<res.meta.length; i++){
let eachTag:MetaDefinition;
if(res.meta[i].metaType== "name"){
eachTag={
name:res.meta[i].tag,
content: res.meta[i].content
}
} else{
eachTag={
property:res.meta[i].tag,
content: res.meta[i].content
}
}
tags.push(eachTag);
}
this.metaTagService.addTags(tags);
})
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version
)
{
"name": "cms-website-ui",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"dev:ssr": "ng run cms-website-ui:serve-ssr",
"serve:ssr": "node dist/cms-website-ui/server/main.js",
"build:ssr": "ng build && ng run cms-website-ui:server",
"prerender": "ng run cms-website-ui:prerender"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.1.0",
"@angular/common": "^14.1.0",
"@angular/compiler": "^14.1.0",
"@angular/core": "^14.1.0",
"@angular/forms": "^14.1.0",
"@angular/platform-browser": "^14.1.0",
"@angular/platform-browser-dynamic": "^14.1.0",
"@angular/platform-server": "^14.1.0",
"@angular/router": "^14.1.0",
"@nguniversal/express-engine": "^15.2.0",
"express": "^4.15.2",
"http-client": "^4.3.1",
"ngx-seo": "^5.3.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.1.3",
"@angular/cli": "~14.1.3",
"@angular/compiler-cli": "^14.1.0",
"@nguniversal/builders": "^15.2.0",
"@types/express": "^4.17.0",
"@types/jasmine": "~4.0.0",
"@types/node": "^14.15.0",
"jasmine-core": "~4.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.7.2"
}
}
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area: serverIssues related to server-side renderingIssues related to server-side renderingneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherThis issue needs a reproduction in order for the team to investigate further