Cordova hello world plugin not working


I’m a begginer in cordova and ionic development.
I try to write a simple cordova plugin and use that in ionic project.
I use this plugin.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns=""

    <author>author name</author>
    <js-module src="www/functions.js" name="device">
        <clobbers target="device" />

and this is my functions.js:

exports.getData = function() {
    return 'plugin test';

and try to call my plugin function from ionic and angular controller:

$scope.callFunc1 = function () {
    // and also try below code:
    // alert(;
    // and also try below code:
    // alert(;

but no alert() message display in my page.

I also try to use this plugin. Install used this command:

cordova plugin add

and use this code to call helloWorld function:

$scope.callFunc1 = function () {

and also test this:

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {


    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required

but no alert() message display in my page and I got this error in firebug:

Error: navigator.helloworld is undefined ....

what is the problem??

Thanks for your attentions.
Link to this question in stackoverflow is here.