Device back button is not working on my Ionic project when i click on device back button it will exit

when i am use cordovajs that time i click on device back button automatically closed please go through

document.addEventListener(“deviceready”, onDeviceReady, false);

function onDeviceReady() {
	alert("Device ready");       
    document.addEventListener("backbutton", onBackKeyDown, false);

// Handle the back button
function onBackKeyDown() {
	//alert("Device back button is not working");
	//if(window.location.when =='/Home'){
		// if ($ == "/Home") {
	     if($location.path =='/Home'){
        var action= confirm("Do you want to Exit?");
          }//no else here just if
             disableBack: true
	//alert("go back");