This may be a bug introduced at version 4.16? Adding a bookmark from the widget result to an error. You can reproduce this error by adding the bookmark widget on the view. make sure the view is tied to a Map instance and not a webMap.
Bookmarks are only able to be added to a WebMap. They are not supported in the Map instance. We will try to clarify this in the documentation and we plan on improving the Bookmarks widget to handle this error better. Thanks for your feedback!
Hi again, Richard! Thanks again for your feedback, we actually decided to support adding bookmarks to the Bookmarks widget when it's tied to a Map instance for the 4.17 release. If you want to test it out early you can use https://js.arcgis.com/next in your app instead of
https://js.arcgis.com/4.16. Let us know what you think!
This is good news! I was just about to drop this feature from the application since I do not have much time to rewrite this whole widget from scratch. Thank you Anne Fitz for adding this!! Really appreciated !
Quick bookmark widget question: I see that it's now supported with a Map instance but how do bookmarks propagate in the browser for a specific app? I might be missing something but when I save bookmarks in an mapping application and refresh, they are no longer there. Do I need to wire this up with cookies?
To save the bookmarks you would need to use a WebMap instead of a Map instance. Then you can use the WebMap.save() or WebMap.saveAs() method to save the bookmarks to your webmap.
Here's an example: https://codepen.io/annefitz/pen/pobJXRx