I have been trying to work with the code, I added the button but I don't know how to link it to another page when clicking on it.
相关问题
- How can I create this custom Bottom Navigation on
- Plugin with id 'com.google.gms.google-services
- How to pass form data from Ionic 3 to PHP file?
- apk big size with ionic 4 build
- Ionic Spinner not showing up
相关文章
- Ionic 4: Hardware Back Button Reloading Applicatio
- ionic - Copy/paste in input field in iOS 10 not wo
- net::ERR_CONNECTION_REFUSED ionic
- Android Navigation Drawer Show Up Indicator for Lo
- How to Setup Jetpack Navigation with material.Bott
- Typescript Error: Property 'files' does no
- ionic 4 + angular: routerLink only works first tim
- Ionic conditional class css
html:
OR
in TS:
you can also use angular to do this for you:
You would need to have a controller to and define doSomething()
If you needed to change your state, the inject $state into your controller and use $state.go(stateName)
ref: https://github.com/angular-ui/ui-router/wiki
This is what i used
Navigation works differently in ionic and it is not advised to simply use an anchor tag and the path to the file.
Here is an example which works. In the relevant TS file import the page(s) you want to navigate to like so
Ensure that you have the navigation controller imported and injected into the constructor of your current TS file. It should look like the following in case you are not sure.
Then in constructor
Once you have the navigation controller and the page(s) imported you can proceed to create a function like so
That completes the navigation setup for your TS file. Now you go to the relevant template you want to navigate from and you can use any tags you want for instance
or you can use an a, span or div in a similar way
You don't necessarily have to use the click event you can use whatever event you want. The main things are that you have the navigation controller imported and injected in your constructor as shown above and you have the page(s) you want to navigate to imported as well and you only use the navigation controller to push pages you want to navigate to.
Place button inside anchor tag.
You can also refer this link: http://www.w3schools.com/tags/tag_a.asp