angular - can't run rxjs interval with angular universalAngular HTML bindingAngular and Typescript: Can't find namesAngular HTTP GET with TypeScript error http.get(…).map is not a function in [null]What is the equivalent of ngShow and ngHide in Angular 2+?What is the correct way to share the result of an Angular Http network call in RxJs 5?Angular DI Error - EXCEPTION: Can't resolve all parametersAngular/RxJs When should I unsubscribe from `Subscription`Huge number of files generated for every Angular projectCan't bind to 'ngModel' since it isn't a known property of 'input'Angular 5 terminate a function after navigation
Why should public servants be apolitical?
Did Captain America make out with his niece?
Will a paper be retracted if a flaw in released software code invalidates its central idea?
Is there a Kolmogorov complexity proof of the prime number theorem?
Did Apollo leave poop on the moon?
How can I make Ubuntu run well (including with wifi) on a 32-bit machine?
What are these mathematical groups in U.S. universities?
"How do you solve a problem like Maria?"
Validation and verification of mathematical models
Best way to explain to my boss that I cannot attend a team summit because it is on Rosh Hashana or any other Jewish Holiday
If a pawn is promoted to queen beside the king is the king instantly in check?
Can chords be inferred from melody alone?
Does bottle color affect mold growth?
Japanese equivalent of a brain fart
Is it allowed and safe to carry a passenger / non-pilot in the front seat of a small general aviation airplane?
History of cluster failover
If there were no space agencies, could a person go to space?
Why is Chromosome 1 called Chromosome 1?
Evolution of Pikachu: Pokemon Go
How can glass marbles naturally occur in a desert?
Is there a loss of quality when converting RGB to HEX?
Why should I "believe in" weak solutions to PDEs?
Why can I log in to my Facebook account with a misspelled email/password?
Premier League simulation
angular - can't run rxjs interval with angular universal
Angular HTML bindingAngular and Typescript: Can't find namesAngular HTTP GET with TypeScript error http.get(…).map is not a function in [null]What is the equivalent of ngShow and ngHide in Angular 2+?What is the correct way to share the result of an Angular Http network call in RxJs 5?Angular DI Error - EXCEPTION: Can't resolve all parametersAngular/RxJs When should I unsubscribe from `Subscription`Huge number of files generated for every Angular projectCan't bind to 'ngModel' since it isn't a known property of 'input'Angular 5 terminate a function after navigation
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I made a carousel effect through the RXJS's interval timing to change parameter.
I found that it works in development mode(ng serve), but it does not work properly in the universal mode, It's can't enter the page.
For example:
n: number = 0;
max: number = 5;
constructor()
ngOnInit()
this.carousel();
carousel()
this.subscription = interval(2000).subscribe(() =>
//In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
console.log(`show the photo: $this.n`);
if (this.n>this.max)
this.n = 0;
else
this.n = this.n+1;
ngOnDestroy()
this.subscription.unsubscribe();
I found in universal model, assume that the carousel effect is on the page B, you can successfully enter page B through the link on page A, but opening page B directly will fail.
I tried to start the carousel in ngAfterContentInit() and it doesn't work.
add a comment |
I made a carousel effect through the RXJS's interval timing to change parameter.
I found that it works in development mode(ng serve), but it does not work properly in the universal mode, It's can't enter the page.
For example:
n: number = 0;
max: number = 5;
constructor()
ngOnInit()
this.carousel();
carousel()
this.subscription = interval(2000).subscribe(() =>
//In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
console.log(`show the photo: $this.n`);
if (this.n>this.max)
this.n = 0;
else
this.n = this.n+1;
ngOnDestroy()
this.subscription.unsubscribe();
I found in universal model, assume that the carousel effect is on the page B, you can successfully enter page B through the link on page A, but opening page B directly will fail.
I tried to start the carousel in ngAfterContentInit() and it doesn't work.
add a comment |
I made a carousel effect through the RXJS's interval timing to change parameter.
I found that it works in development mode(ng serve), but it does not work properly in the universal mode, It's can't enter the page.
For example:
n: number = 0;
max: number = 5;
constructor()
ngOnInit()
this.carousel();
carousel()
this.subscription = interval(2000).subscribe(() =>
//In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
console.log(`show the photo: $this.n`);
if (this.n>this.max)
this.n = 0;
else
this.n = this.n+1;
ngOnDestroy()
this.subscription.unsubscribe();
I found in universal model, assume that the carousel effect is on the page B, you can successfully enter page B through the link on page A, but opening page B directly will fail.
I tried to start the carousel in ngAfterContentInit() and it doesn't work.
I made a carousel effect through the RXJS's interval timing to change parameter.
I found that it works in development mode(ng serve), but it does not work properly in the universal mode, It's can't enter the page.
For example:
n: number = 0;
max: number = 5;
constructor()
ngOnInit()
this.carousel();
carousel()
this.subscription = interval(2000).subscribe(() =>
//In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
console.log(`show the photo: $this.n`);
if (this.n>this.max)
this.n = 0;
else
this.n = this.n+1;
ngOnDestroy()
this.subscription.unsubscribe();
I found in universal model, assume that the carousel effect is on the page B, you can successfully enter page B through the link on page A, but opening page B directly will fail.
I tried to start the carousel in ngAfterContentInit() and it doesn't work.
edited Mar 27 at 8:38
Albert
asked Mar 27 at 5:51
AlbertAlbert
1674 silver badges17 bronze badges
1674 silver badges17 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370609%2fangular-cant-run-rxjs-interval-with-angular-universal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370609%2fangular-cant-run-rxjs-interval-with-angular-universal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown