I am attempting to use a Parse server and am currently running into issues with initializing Parse in javascript and pointing to the correct serverURL. Curious if anyone else has had any luck doing this with Angular2 yet?
For frameworks that use typescript (ex. angular 2, ionic 2 & 3),
To solve the typescript read-only error:
Typescript Error
Cannot assign to 'serverURL' because it is a constant or a read-only property.
Parse.serverURL = 'http://localhost:1337/parse';
Use (Parse as any)
instead of Parse
to set the value of serverUrl such as:
import * as Parse from 'parse';
Parse.initialize('appId', 'jsKey'); // use your appID & your js key
(Parse as any).serverURL = 'http://localhost:1337/parse'; // use your server url
This require parse and @types/parse to be installed:
npm install --save @types/parse parse
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With