jeudi 9 février 2017

Ember.js dynamic route segment with a hash sign with locationType: "hash"

I'm building an Ember application that takes path to other document as a route dynamic segment parameter. The document is further displayed in iframe inside my app. I'm using a locationType: hash option in environment and a wildcard route as in this answer: http://ift.tt/2kws5R5

The route is defined as:

this.route('display', {path: '*document_path'});

After entering URL like this:

http://localhost/#/display/some/document.html

The route:display invokes model method with parameter:

{ document_path: "some/document.html" }

I want to be able to pass # sign in the document_path, but entering URL like this:

http://localhost/#/display/some/document.html#some-paragraph

cuts everything after the # sign and passes:

{ document_path: "some/document.html" }

into the model.

I know that it works if I change locationType to history. But at the moment for some reason I want to use hash locationType.

It is possible to pass the # as a dynamic segment when using locationType: hash?

Aucun commentaire:

Enregistrer un commentaire