createBookmark method is not available in BookmarksViewModel

369
1
12-06-2019 06:31 AM
Alaa_Bakry_AbdelazizABDELFATTA
New Contributor

I am trying to create my own Bookmark widget using BookmarksViewModel

However I  can not create a bookmark 

And that's simply because the function createBookmark is not available.

I basically create a bookmarkviewmodel instance using this line: 

this.bookmarksViewModel = new BookmarksViewModel({view: this._mapWidgetModel.view});

I was then trying to use this code snippet from the documentation: 

// Creates new bookmark from current view extent

this.bookmarksViewModel.createBookmark().then(function(bookmark){

// Give the bookmark a name

bookmark.name = "New Bookmark";

// Add to bookmarks list

this.bookmarksViewModel.bookmarks.add(bookmark);

});

However, the createBookmark function is not available either in BookmarksViewModel nor in map view object.

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

The createBookmark() method seems to work with the BookmarksViewModel class. Here's a simple case with the method wired up to a button:

sample

https://codepen.io/noash/pen/eYmpWrP 

0 Kudos