1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Can't put a breakpoint in Angular constructor or OnInit

Discussão em 'Angular' iniciado por Felix, Novembro 9, 2024 às 17:22.

  1. Felix

    Felix Guest

    I have an Angular application, and I am trying to set a breakpoint using F12 tools in Chrome or IE. I have simple test case:

    export class LoginComponent implements OnInit {
    message: string;

    constructor(private router: Router) {
    console.log("Login Constructor");
    }

    ngOnInit() {
    console.log("Login OnInit");
    }
    }


    I see the log output in the console, but setting a breakpoint doesn't work.

    I think it stopped working a few days ago (not sure if it was an upgrade of some library, or Windows, or both browsers). Don't even know where to start looking. The project is built with webpack, and I am getting to this component via routing:

    const appRoutes: Routes = [
    {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full'
    },
    {
    path: '/login',
    component: LoginComponent
    }
    ...
    ]


    Note, that button click handler breaks as expected.

    Continue reading...

Compartilhe esta Página