angular2-universal

Unable to find plugin: videoJsResolutionSwitcher in angular2-universal

老子叫甜甜 提交于 2019-12-25 08:35:47
问题 In the first implementation, I used angular2 without server rendering for creating a web player with video.js library and it's "videojs-resolution-switcher" plugin. I created a directive for initializing videojs element based on component ngOnInitView and load js files directly in base html file (end of body). Everything was correct and player worked as expected. Then I started to setting up angular2-universal and server rendering. There was some problems about using browser specific features

How to install Angular2 universal when the docs on the site are outdated?

你说的曾经没有我的故事 提交于 2019-12-09 10:22:52
问题 The maintainers at angular2-universal have not updated their site: Problem 1) typings install node express body-parser serve-static express-serve-static-core mime --ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead Problem 2) typings install node express body-parser serve-static express-serve-static-core mime --global typings INFO globaldependencies "express" lists global dependencies on "node" that must be installed manually typings INFO

How to deploy angular 4 universal app to firebase

丶灬走出姿态 提交于 2019-12-06 09:24:43
问题 With the introduction to angular 4 of universal, I can't figure out how to deploy the app successfully to a firebase hosting. I followed the steps here https://github.com/angular/angular-cli/wiki/stories-universal-rendering I can't figure out this part of it though: "The bundle produced has a hash in the filename from webpack. When deploying this to a production server, you will need to ensure the correct bundle is required, either by renaming the file or passing the bundle name as an

How to deploy angular 4 universal app to firebase

北慕城南 提交于 2019-12-04 16:47:25
With the introduction to angular 4 of universal, I can't figure out how to deploy the app successfully to a firebase hosting. I followed the steps here https://github.com/angular/angular-cli/wiki/stories-universal-rendering I can't figure out this part of it though: "The bundle produced has a hash in the filename from webpack. When deploying this to a production server, you will need to ensure the correct bundle is required, either by renaming the file or passing the bundle name as an argument to your server." Usually we just use ng build --prod Then firebase deploy the dist directory. With

How to install Angular2 universal when the docs on the site are outdated?

会有一股神秘感。 提交于 2019-12-03 12:52:10
The maintainers at angular2-universal have not updated their site: Problem 1) typings install node express body-parser serve-static express-serve-static-core mime --ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead Problem 2) typings install node express body-parser serve-static express-serve-static-core mime --global typings INFO globaldependencies "express" lists global dependencies on "node" that must be installed manually typings INFO globaldependencies "body-parser" lists global dependencies on "node" that must be installed manually typings ERR!

localStorage is not defined (Angular Universal)

荒凉一梦 提交于 2019-11-27 03:41:34
I am using universal-starter as backbone. When my client starts, it read a token about user info from localStorage. @Injectable() export class UserService { foo() {} bar() {} loadCurrentUser() { const token = localStorage.getItem('token'); // do other things }; } Everything works well, however I got this in the server side (terminal) because of server rendering: EXCEPTION: ReferenceError: localStorage is not defined I got the idea from ng-conf-2016-universal-patterns that using Dependency Injection to solve this. But that demo is really old. Say I have these two files now: main.broswer.ts

Adding script tags in Angular component template

∥☆過路亽.° 提交于 2019-11-26 21:54:23
Angular2 removes <script> tags automatically from templates to stop people using this functionality as a "poor's man" loader . The issue here is that script tags currently have more uses than just loading code or other script files. There is the possibility that further functionality around <script> tags will be introduced in future as well. One current use is JSON-LD which takes the format <script type="application/ld+json"> { "@context":"http://schema.org", "@type":"HealthClub", ... } </script> A commonly suggested work around is to dynamically add script tags to the document via the

localStorage is not defined (Angular Universal)

泄露秘密 提交于 2019-11-26 10:34:15
问题 I am using universal-starter as backbone. When my client starts, it read a token about user info from localStorage. @Injectable() export class UserService { foo() {} bar() {} loadCurrentUser() { const token = localStorage.getItem(\'token\'); // do other things }; } Everything works well, however I got this in the server side (terminal) because of server rendering: EXCEPTION: ReferenceError: localStorage is not defined I got the idea from ng-conf-2016-universal-patterns that using Dependency

Adding script tags in Angular component template

心已入冬 提交于 2019-11-26 08:07:01
问题 Angular2 removes <script> tags automatically from templates to stop people using this functionality as a \"poor\'s man\" loader. The issue here is that script tags currently have more uses than just loading code or other script files. There is the possibility that further functionality around <script> tags will be introduced in future as well. One current use is JSON-LD which takes the format <script type=\"application/ld+json\"> { \"@context\":\"http://schema.org\", \"@type\":\"HealthClub\",