I want to apply a definitionExpression to a feature layer after it's been created in my TypeScript project with this code.
const exp = 'OBJECTID = 1';
regionLayer.definitionExpression(exp);
but I am getting the error
Error TS2349 (TS) This expression is not callable.
Type 'String' has no call signatures
If I add the property when I create the feature layer, I don't get this error
const test = 'OBJECTID = 1';
const regionLayer = new FeatureLayer({
url: url,
definitionExpression: test,
outFields: ['*']
});
but I have the change the definitionExpression when the user makes certain choices.
What is causing this error?
Solved! Go to Solution.
Ken, I believe this is a String property and not a method; maybe try this:
const exp = 'OBJECTID = 1';
regionLayer.definitionExpression = exp;
Ken, I believe this is a String property and not a method; maybe try this:
const exp = 'OBJECTID = 1';
regionLayer.definitionExpression = exp;
Thanks John! What a silly mistake...