angularjs - Angular.js - Jade, Form Submission -


i'm new angular , i'm building first realtime page based on boiler plate from:

https://github.com/jimakker/angular-express-bootstrap-seed

i'm not able first form submit. in fact, nothing happens when click button. given below relevant snippets code:

partial view:

.row form(ng-controller='registerctrl')     #accordion.panel-group            //- panel 1            .panel.panel-default             .panel-heading                 h4(class='panel-title')                     a(data-target='#collapse1', data-toggle="collapse", data-parent="#accordion", class="left-m-1em cursor-pointer") basic information             #collapse1.panel-collapse.collapse                 .panel-body                     .row                         .col-lg-2(ng-controller='dropdownctrl')                             select(id="gender", ng-model='register.gender', ng-init="getvalues('gender')", ng-options='r.value r in results track r.key', chosen, class="form-control", data-placeholder="gender", data-toggle="tooltip", data-trigger="hover", data-placement="top", title="gender")                                 option(value="")   //- more panels in between , finally, panel 6            .panel.panel-default             .panel-heading                 h4(class='panel-title')                     a(data-target='#collapse6', data-toggle="collapse", data-parent="#accordion", class="left-m-1em cursor-pointer") family             #collapse6.panel-collapse.collapse                 .panel-body                     .row                         .col-lg-3.col-lg-offset-5                             button(type="button", class="btn btn-success btn-lg", ng-click="saveprofile")                                 span(class="glyphicon glyphicon-ok-circle")                                  | submit 

i looked @ rendered output , confirmed submit button indeed within form tag.

controller:

function registerctrl($scope, $http) { $scope.register = {}; $scope.saveprofile = function(item, event) {     alert("called this!");     var json = {         gender: $scope.register.gender,         marital_status: $scope.register.marital_status,         dob: $scope.register.dob,         height: $scope.register.height,         weight: $scope.register.weight,         complexion: $scope.register.complexion,         health: $scope.register.health     };      var responsepromise = $http.post("/api/register", json, {});     responsepromise.success(function(datafromserver, status, headers, config) {         console.log(datafromserver.title);     });     responsepromise.error(function(data, status, headers, config) {         alert("submitting form failed!");     });  }; } registerctrl.$inject = ['$scope', '$http']; 

i'm not hitting first alert statement , i'm totally unsure why. other controller dropdownctrl (used individual form elements) works fine , i'm able populate values dynamically using controller. please me find missing piece.

the syntax ng-click="saveprofile()" rather ng-click="saveprofile"

note won't pass arguments function, if want need pass them inside markup too.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -