Feedback plugin within MVVM - Javascript


#1

Thanks for the plugin, works fine fine from .js, but can’t get it to work from the view-model.
I have this on my VM:

var FeedbackPlugin = require("nativescript-feedback");
var feedback = new FeedbackPlugin.Feedback();
function sidebarViewModel() {

var viewModel = new observableModule.fromObject({
onOpenDrawerTap : function(){
var sideDrawer = frame.topmost().getViewById("sideDrawer");
sideDrawer.showDrawer();
},
onCloseDrawerTap : function(){
var sideDrawer = frame.topmost().getViewById("sideDrawer");
sideDrawer.closeDrawer();
},
onToggleDrawerState : function(){
var sideDrawer = frame.topmost().getViewById("sideDrawer");
this.feedback.success({
title: "success",
message: "Info is relevant data, not just any data."
});

return viewModel;
}
module.exports = sidebarViewModel;

The "onToggleDrawerState " is bounded to the UI thrugh xml file as follows:

<NavigationButton icon="res://menubar" tap="{{onToggleDrawerState}}"/>

but I always get this error: Cannot read property ‘success’ of undefined

any help!!!

Best,
Waleed


#2

all of a sudden it start to works, after few builds …

Thanks all


#3

You probably never did a full build (refresh of the platforms folder) after adding the plugin. Next time (and in case it really is a problem with the plugin) feel free to post an issue on my Github project page instead of here.