External TemplateUrl on @Component with dynamic parameters


#1

Hi guys, i have 2 questions -

I have several components in my app that need to fetch the template from the server ( i know it’s probably not best practice, but the contents of these components change regularly and it’s impossible to release new app version everytime for both platforms).

@Component({
  selector: 'dashboard-content',
  templateUrl: 'https://_external.url_/content/landing.html'
})
export class DashboardContent {
  constructor(public renderer: Renderer, public viewCtrl: ViewController, public navCtrl: NavController) {
     ....
  }
}

question 1

Is it possible to catch if for some reason (network issues etc.) the url can’t be resolved and display a friendly error message?

question 2

On top of this i need to pass a language argument to the url - how can i achieve that?

The templates served from server contain ionic components, this was the only way i was able to achieve their rendering as [innerHTML] is not good in this case. Should i perhaps use different approach to this?

Many Thanks!


#2

I have the same Problem! I want to use an external template (the URL from my server) but it didn’t work! Any solution ?