0

I have an issue with deeplinks which blocks angular's two-way-binding.

I made a test project in git. Please check here (This is a simple ionic default project. If you have already installed npm and ionic-cli, just run npm i, ionic cordova platform add ios)

Explain about the project 1. Working case

  • There are 3 pages. Home, List and Modal.
  • Each pages have an input and this input's variable is connected with test variable. And this test is shown just under the input

Like:

<input (input)="testFn($event)" name="myTest"> 
<p>Hello {{test}}!</p>
  • Every page, whenever I type in the input, it immediately reflects in {{test}}.
  • Everything seems ok.

2. Not working case

  • If you check app.component.ts, you will see deeplinks is set as this.nav.push('ListPage'); and the url is myapp://list

  • So in my xcode iphone emulator, I will open safari and type in the address bar as myapp://list. It will redirect you to the List page.

  • Since then, type in the input to reflect to {{test}} is not working in the List page and the Modal page. But working in the Home page.
  • In testFn function, I put console.log. When I test, console.log always prints properly. So I guess angular is not updating properly. ( If you don't see keyboard in xcode iPhone emulator : cmd + shift + k )

My environment

  • Ionic Framework: 3.5.0
  • Ionic App Scripts: 1.3.12
  • Angular Core: 4.1.3
  • Angular Compiler CLI: 4.1.3
  • Node: 7.10.0
  • OS Platform: macOS Sierra
  • Navigator Platform: MacIntel
  • User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1
  • Xcode : 8.3.3 (8E3004b)
  • Emulator : iPhone 5 iOS 10.3 (14E8301)

I tried also ionic cordova platform rm ios and ionic cordova platform add ios but no luck.

Can anyone tell me what is wrong with my code?

Thank you very much.

EDIT : I can use ChangeDetectorRef's detectChanges to force to update the view. But I don't think this is a good solution.

Téwa
  • 1,184
  • 2
  • 13
  • 19

0 Answers0