Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: cannot find module nativescript-angular/router or its corresponding type declarations

Reading the native script documentation and watching videos I want to use RouterExtensions but I get the following error:

cannot find module nativescript-angular/router or its corresponding type declarations

My code

import { Component, OnInit } from '@angular/core';
import { Page } from "tns-core-modules/ui/page";
import { RouterExtensions } from "nativescript-angular/router";
    
@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
    
  constructor( private page: Page,private routerExtensions: RouterExtensions) {
    
    page.actionBarHidden = true;
              
  }
    
  onAccess(){
    //log here
  }

  ngOnInit() {
  }
}

Screen error

like image 461
Carlos Felipe Gonzalez Avatar asked May 02 '26 06:05

Carlos Felipe Gonzalez


1 Answers

Change: import { RouterExtensions } from "nativescript-angular/router";

Into: import { RouterExtensions } from "@nativescript/angular/router";

In newer versions of nativescript/angular projects.

Kind Regards

like image 179
Rdev Avatar answered May 04 '26 07:05

Rdev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!