Reputation: 305
While trying to use 'let' in angular 2 I am getting this error : Unexpected Token : A constructor, method, accessor or property was expected.
let options = new RequestOptions({
search: new URLSearchParams('XXX')
});
Upvotes: 2
Views: 1107
Reputation: 34673
You cannot use let
when declaring a class property. You can only use let
in a block scope e.g. inside a method. Change your code to this:
options = new RequestOptions({
search: new URLSearchParams('XXX')
});
you can use public
or private
modifiers before options if you want. If you dont specify any modifier, then by default it is public
.
Upvotes: 2