angularjs - Popup Controller function call in angular.js -


I'm using it because it sounds popular, I'm calling the popup dialog as follows: < / P>

  $ scope.upload = function () {createDialogService ('simpleModal.html', {id: 'simpleDialog', title: 'India to upload video', background: true, controller: 'Trafficist Controller', success: {label: 'success', FN: function () {console.log ('simple mode off');}}}); };   

And in my simpleModal.html only the following (a form)

  & lt; Div class = "row-fluid" & gt; it happens. & Lt; form ng-submit = "addNewVideo ()" & gt; & Lt; Input type = "text" ng-model = "newVid.videoURL" placeholder = "video url here" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "newVid.locality" placeholder = "locality" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "newVid.town" placeholder = "city" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "newVid.city" placeholder = "city" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "newVid.pincode" placeholder = "pin code" value = "600015" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-model = "newVid.time" placeholder = "yyyy-mm-dd hh: mm" value = "2014-03-20 08:20" & gt; & Lt; Br / & gt; & Lt; Input type = "SUBMIT" value = "add video" class = "btn-primary" & gt; & Lt; / Form & gt; & Lt; / Div & gt;   

But when I click the submit button in the popup form, it throws an error TypeError: unchanged and my addNewVideo property 'videoURL 'Can not read () looks like this:

  $ scope.addNewVideo = function () {var vid = {}; $ Log.log ($ scope); Vid ["videoURL"] = $ scope.newVid.videoURL; Vid ["thumbURL"] = $ scope.newVid.videoURL; Vid ["uploaded"] = "any"; Vid ["analysis"] = ""; Vid ["locality"] = $ scope.newVid.locality; Vid ["town"] = $ scope.newVid.town; Vid ["city"] = $ scope.newVid.city; Vid ["pincode"] = $ scope.newVid.pincode; Vid ["time"] = $ scope.newVid.time; var json = JSON.stringify (vid); }   

But if I embed in the page instead of a popup on the page, then it works fine. I'm not sure whether the popup is using the same example as TrafficListController or creating a new one even if it creates a new instance, then this particular function is addNewVideo ( ) Other examples are not dependent on any other properties / wars and they should work.

What am I wrong? Any help?

Reference: index.html: trafficListController.js:

You can add your addVideo function Trying to read from $ scope.newVid , but it does not exist Try to initialize this object first.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -