@@ -20,11 +20,10 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
2020 console . error ( "Error: " , err ) ;
2121 return ;
2222 }
23-
24- if ( result && result . data && ! angular . equals ( { } , result . data ) ) {
23+ if ( result && result . data && ! angular . equals ( { } , result . data ) && result . id ) {
2524 $scope . data = result . data ;
2625 $scope . id = result . id ;
27- if ( typeof result . data . content . openInApp != 'undefined' ) {
26+ if ( typeof result . data . content . openInApp != 'undefined' && typeof result . data . content . openInApp != 'object' ) {
2827 if ( result . data . content . openInApp )
2928 $scope . data . content . view = $scope . viewType . NATIVE_IN_APP ;
3029 else
@@ -33,7 +32,7 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
3332 } else {
3433 $scope . data = {
3534 content : {
36- url : "" ,
35+ url : "http://hellacompany.com/ " ,
3736 view : $scope . viewType . NATIVE_IN_APP
3837 }
3938 } ;
@@ -83,7 +82,8 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
8382 if ( ! / ^ h t t p s ? \: \/ \/ / . test ( data . content . url ) ) {
8483 data . content . url = "http://" + data . content . url ;
8584 }
86- if ( data . content . openInApp != 'undefined' )
85+
86+ if ( data . content . openInApp != undefined )
8787 data . content . openInApp = null ;
8888 buildfire . datastore . save ( data , function ( err , result ) {
8989 if ( err || ! result ) {
@@ -104,8 +104,10 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
104104 dataChanged = true ;
105105 if ( ! $scope . frmMain . $invalid ) {
106106 var data = $scope . data ;
107- if ( data . content . openInApp != 'undefined' )
107+ console . log ( "***********save" , data . content . openInApp ) ;
108+ if ( data . content . openInApp != undefined ) {
108109 data . content . openInApp = null ;
110+ }
109111 buildfire . datastore . save ( data , function ( err , result ) {
110112 if ( err || ! result ) {
111113 $log . error ( 'Error saving the widget details: ' , err ) ;
@@ -127,5 +129,5 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
127129 $log . info ( 'Widget details saved' ) ;
128130 }
129131 } ) ;
130- }
132+ } ;
131133} ] ) ;
0 commit comments