angularjs - Error: [ng:areq] controller is not function got undefined -
for above error have referred solutions avalilable on , other sites still facing same issue. following html code:
<div ng-app="importcontactsapp" class="modal fade" id="invitemodal" tabindex="-1" role="dialog" aria-labelledby="modallabel" aria-hidden="true"> <div class="modal-dialog import-contacts-dialog"> <div ng-controller="importctrl" class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">close</span></button> </div> <div class="modal-body"> <h4 class="modal-title" id="linemodallabel">invite friends email.</h4> <p> </p> <form action="" ng-submit="submit_contacts() "> <div class="row"> <div class="form-group col-sm-8 "> <input type="email" class="form-control" id="exampleinputemail1" placeholder="enter email"> </div> <div class="col-sm-4" > <button type="submit" class="btn btn-primary btn-block">invite</button> </div> </div> <div class="row"> <h3 class="col-xs-12 mp_blue text-center "><hr> --- or ---<hr> </h3> </div> <div id="dvimportsegments" class="fileupload "> <div class="row"> <div class="col-sm-8 "> <h4 class="modal-title">import contacts invite , connect them. </h4> </div> <div class="col-sm-4"> <div class="btn btn-primary btn-block image-preview-input marg0"> <span class=" glyphicon glyphicon-folder-open"></span> <span class="image-preview-input-title">import</span> <!--<input ng-model="formdata.file" type="file" id="contactfileupload" accept=".csv .vcard" name="file upload"/></input> <!-- rename --> <input type="file" ng-model="formdata.file" multiple="" name="files" id="wizard-picture"> </div> <div class="btn btn-primary btn-block image-preview-input marg0"> <span class=" glyphicon glyphicon-folder-open"></span> <span class="image-preview-input-title">save</span> <input type="submit"> </div> <div> <a class="small" href="learn-how.html">learn how</a> </div> </div> </div> </div><!--end of upload contacts--><br> </form> </div> </div> </div> </div><!--end of modal-->
below angular code: have written both parts in same file.
var app = angular.module('importcontactsapp', []); app.controller('importctrl', function($scope, $http) { $scope.formdata = {}; $scope.name = 'world'; });
following list of files have included:
<script type="text/javascript" src="jquery-1.11.0.min.js"></script> <script src="bootstrap.js"></script> <script type="text/javascript" src="angular.min.js"></script> <script src="djangular/js/django-angular.min.js" type="text/javascript"></script> <script type="text/javascript" src="angular-route.min.js"></script> <script type="text/javascript" src="wizvalidation/wizvalidation.js"></script> <script type="text/javascript" src="angular-cookies.js"></script>
you have not put correct ng-app
name,
from module name ,
var app = angular.module('importcontactsapp', ['angular-confirm', 'angular-alert']);
change
from:
<form ng-app="myapp" ng-controller="importctrl" action="" ng-submit="submit_contacts()">
to:
<form ng-app="importcontactsapp" ng-controller="importctrl" action="" ng-submit="submit_contacts()">
Comments
Post a Comment