Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49087

Using this.$router not working

$
0
0

Hi,

I’m using this code to navigate to another page but it doesn’t work because of TypeScript, it gives this error:

Property '$router' does not exist on type '{ openPage(p: object): void; }'.

Code:

<script lang="ts">
  methods: {
    openPage(p: object) {
      this.$router.push(p.path)
    }
  }

If I remove …

lang="ts">

… it works fine. Is there a specific issue with TypeScript not detecting this as a feature of Vue?

Thank you.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 49087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>