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
withtest
variable. And thistest
is shown just under theinput
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 ismyapp://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 putconsole.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)
Ionic info
global packages:
- @ionic/cli-utils : 1.4.0
- Cordova CLI : Update notifier was not able to access the config file. You may grant permissions to the file: ‘sudo chmod 744 ~/.config/configstore/update-notifier-cordova.json’ 7.0.1
- Ionic CLI : 3.4.0
local packages:
- @ionic/app-scripts : 1.3.12
- @ionic/cli-plugin-cordova : 1.4.0
- @ionic/cli-plugin-ionic-angular : 1.3.1
- Cordova Platforms : Update notifier was not able to access the config file. You may grant permissions to the file: ‘sudo chmod 744 ~/.config/configstore/update-notifier-cordova.json’ ios 4.4.0
- Ionic Framework : ionic-angular 3.5.0
System:
- Node : v7.10.0
- OS : macOS Sierra
- Xcode : Xcode 8.3.3 Build version 8E3004b
- ios-deploy : 1.9.1
- ios-sim : 5.0.6
- npm : 4.2.0
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.
EDIT : I updated with ionic info