StealthTrails
StealthTrails

Reputation: 2415

Cannot find name 'Parse'. Angular 4

I am getting this error while trying to use parses in my Angular 4 project. I have installed the parse as npm module. This is my typescript file.

import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'app-post',
    templateUrl: './post-component.component.html',
    styleUrls: ['./post-component.component.min.css']
})
export class PostComponentComponent implements OnInit {
    Parse  = null;
    Users = null;

    constructor() {
        Parse.initialize('MY_APP_ID', '');
        Parse.serverURL = 'http://xt1.westeurope.cloudapp.azure.com:1337/parse';

        this.Users = Parse.Object.extend('User');
        console.log('Helo');
    }

    ngOnInit() {
    }
}

This is the exact error that I am getting. I am a beginner with Angular 4 and Parse so I dont know much to do.

Cannot find name 'Parse'. Did you mean the instance member 'this.Parse'?

Upvotes: 1

Views: 1205

Answers (1)

El houcine bougarfaoui
El houcine bougarfaoui

Reputation: 37343

first install its typing :

npm install --save @types/parse

then you have to import it first :

import * as Parse from 'parse';

@Component({
    selector: 'app-post',
    templateUrl: './post-component.component.html',
    styleUrls: ['./post-component.component.min.css']
})
//...

Upvotes: 4

Related Questions