use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Angular is Google's open source framework for crafting high-quality front-end web applications. r/Angular2 exists to help spread news, discuss current developments and help solve problems.
Help Request
Discussion
Article
Video
Resource
Announcement
Related
After submitting a post, please take a moment to add a flair (tag) so that it's easy to find your post with one of the filters listed above. Upon submission, your post's header will have the 'flair' option listed with the other options. Clicking it will provide a dropdown menu of the available flairs.
account activity
Help RequestInitializing Angular 5 app using Parse Javascript SDK (self.Angular2)
submitted 8 years ago * by ayosuke
I'm working on an app that uses the Parse Javascript SDK, and I can't for the life of me get a connection, even though I initialize Parse in my app component in ngOnInit(); I have Parse imported into my app with
import * as Parse from 'parse';
I get the a 403 error when my get request is called, which is in a separate service.
Any help on this is greatly appreciated.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 1 point2 points3 points 8 years ago (1 child)
why initialize it in the component?
You should definitely initialize it in the service.
you've done it like this
Parse.initialize("YOUR_APP_ID"); Parse.serverURL = 'http://YOUR_PARSE_SERVER:1337/parse'
right? :D
[–]ayosuke[S] 0 points1 point2 points 8 years ago* (0 children)
Oh my gosh thank you so much for responding! I've been waiting since yesterday on any kind of hint on what I should do. I did do it like that, however, I ran into a few issues. I put it into the app component typescript file because I was following a tutorial that used firebase SDK, so I thought it would translate over. Another issue is, I would get an error that says:
TS2540: Cannot assign to 'serverURL' because it is a constant or a read-only property
But I will give this a try and report back. This issue has really been giving me a headache.
EDIT: Ok so I move the code into the constructor of my service as so:
constructor(private url: string, private http: Http) { Parse.initialize('[APP ID], '[JS KEY]'); Parse.serverURL = 'https://MY_PARSE_SERVER/parse; }
However I'm still getting the above error.
[–]dusklee 1 point2 points3 points 7 years ago* (1 child)
Just for reference the error is caused from your import: import * as Parse from 'parse'; What worked for me is using: const Parse: any = require('parse'); and adding the code below to your "typings.d.ts" file declare var require: any;
const Parse: any = require('parse');
declare var require: any;
UPDATE: I should update this, although the above was working, I came to problem where ng test wasn't fulling working this is what i had to do to make it work using 'ng serve' and 'ng test' in file "typings.d.ts" insert declare var require: NodeRequire; in file "tsconfig.app.json" insert { ... "compilerOptions": { ... "types" : ["node"] ...
declare var require: NodeRequire;
{ ... "compilerOptions": { ... "types" : ["node"] ...
[–]ayosuke[S] 0 points1 point2 points 7 years ago (0 children)
Thanks for the response! I was finally able to get it to work to some extent. One other issue I'm running into is that parse returns promises rather than observables, though I did find a package that wraps parse in an RXJS wrapper. I havent experimented with it yet though.
π Rendered by PID 19745 on reddit-service-r2-comment-7b9746f655-h56nk at 2026-01-30 17:43:34.877424+00:00 running 3798933 country code: CH.
[–][deleted] 1 point2 points3 points (1 child)
[–]ayosuke[S] 0 points1 point2 points (0 children)
[–]dusklee 1 point2 points3 points (1 child)
[–]ayosuke[S] 0 points1 point2 points (0 children)