javascript - Controller issues in Angular -


i have controller simple thing.. opens url being passed using phonegap inapp browser. working no longer working!

.controller('jobdetailctrl', ['$scope', '$routeparams', 'job', 'profile',function ($scope, $routeparams, job,profile) {   $scope.job = job.get({jobid: $routeparams.jobid});   $scope.url=$scope.job.url;   $scope.read($scope.url);                               //defining read function open inapp browser   $scope.read =function(url){          console.log("myurl"+url);          var ref = window.open(url, '_blank', 'location=yes,toolbar=yes');          ref.addeventlistener('exit', function() {  });    }; 

when call function fails. not print in console. please help.

thanks

js

you have define function before calling it... try this

.controller('jobdetailctrl', ['$scope', '$routeparams', 'job', 'profile',function ($scope, $routeparams, job,profile) {    //defining read function open inapp browser   $scope.read =function(url){   ......  };   $scope.read($scope.url); //<<--- invoke read after defining it.    

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -