Kapila Mahesh
Kapila Mahesh

Reputation: 1

After navigate to another page using routerlink in Angular2 URL change but page is not refreshing

I created this project by using Angular-Cli webpack. And I build the project and hosted in AWS with IIS

Here is the github url : https://github.com/igkmahesh/InihilPhotography

Here is the website URL : http://www.inihilphotography.com.au

My Problem is. When i click on any of the Navigation link(About/Portfolio/Contact/....) which is in left side, it change the URL, but page is not loading.

Please help me to solve this issue.

Upvotes: 0

Views: 969

Answers (2)

Kapila Mahesh
Kapila Mahesh

Reputation: 1

Finally I found a solution. The reason for not showing the page after navigate is, I have separate javascript file (custom.script.js) which is doing some modification to DOM after load the page. After navigate to another page by using angular router, those codes are not getting executed.

This is what i did to solve that issue.

  1. Declare jQuery : declare var jQuery:any;
  2. Get the custom.script.js file inside the OnInit method : jQuery.getScript("../../assets/JS/custom.script.js");

.

import { Component, OnInit } from '@angular/core';
declare var jQuery:any;
@Component({
   selector: 'app-about',
   templateUrl: './about.component.html',
   styleUrls: ['./about.component.css']
})
export class AboutComponent implements OnInit {
   constructor() { }
   ngOnInit() {
      jQuery.getScript("../../assets/JS/custom.script.js");
   }
}

Upvotes: 0

Mr C
Mr C

Reputation: 61

All the content is there, you are just seeing right through it to the background :)

You have a "opacity: 0;" in your CSS class right-content.

Upvotes: 1

Related Questions