Javascript 注入器:当我尝试在全压光机内加载角度js时发生Moduler错误
我试图加载一个简单的完整日历插件,在每个日期单击时,我试图显示一个示例模式对话框,该对话框向用户显示选择从数据库中获取的组织和分支的选项,但是角度模块没有加载,变量没有计算,它保持为{{org.orgname}},并且{{branch.branchName} 这是我的javascriptJavascript 注入器:当我尝试在全压光机内加载角度js时发生Moduler错误,javascript,angularjs,twitter-bootstrap-3,Javascript,Angularjs,Twitter Bootstrap 3,我试图加载一个简单的完整日历插件,在每个日期单击时,我试图显示一个示例模式对话框,该对话框向用户显示选择从数据库中获取的组织和分支的选项,但是角度模块没有加载,变量没有计算,它保持为{{org.orgname}},并且{{branch.branchName} 这是我的javascript <script type="text/javascript"> $(function() { var ScheduleApp = angula
<script type="text/javascript">
$(function()
{
var ScheduleApp = angular.module('ScheduleApp', ['ui.calendar','ui.bootstrap']);
ScheduleApp.controller('ScheduleAppContoller', function($scope,$http) {
$scope.organizations = [];
$scope.organization = "";
$scope.branches = [];
$scope.branch = "";
//$scope.managedEntities = [];
var getOrganization = "getOrganizations";
$http.post(getOrganization).success(function(data) {
$scope.organizations = data;
});
$scope.selectBranch = function() {
var orgId = $scope.organization;
var action = "getBranchByOrgId?";
var param = "orgId=" + orgId;
$http.post(action + param).success(function(data) {
$scope.branches = data;
});
}
});
});
</script>
还有我的html
<body ng-app="ScheduleApp">
<div id='calendar' style="Width: 90%; padding-left: 10%"></div>
<div id="createEventModal" class="well modal fade" tabindex="-1" style="Width: 40%; height: 550px; margin-left: 30%; margin-top: 20px;" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true" ng-controller="ScheduleAppContoller">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="myModalLabel1">Create a new Schedule</h3>
</div>
<div class="modal-body">
<form id="createAppointmentForm" class="form-horizontal">
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Title</label>
<div class="col-sm-6">
<input type="text" name="scheduleTitle" id="scheduleTitle"
class="form-control" data-provide="typeahead"> <input
type="hidden" id="apptStartTime" /> <input type="hidden"
id="apptEndTime" /> <input type="hidden" id="apptAllDay" />
</div>
</div>
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Managed
Entity Group:</label>
<div class="col-sm-6">
<input type="text" name="patientName" id="patientName"
class="form-control" style="margin: 0 auto;"
data-provide="typeahead" data-items="4"> <input
type="hidden" id="apptStartTime" /> <input type="hidden"
id="apptEndTime" /> <input type="hidden" id="apptAllDay" />
</div>
</div>
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Organization
:</label>
<div class="col-sm-6">
<select class="form-control" ng-model="organization"
ng-change="selectBranch()" id="organizationId"
name="organizationId">
<option value="">Please select Organization</option>
<option
ng-repeat="organization in organizations|orderBy:'orgName'"
value="{{organization.orgId}}">{{organization.orgName}}</option>
</select>
</div>
</div>
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Branch:</label>
<div class="col-sm-6">
<select class="form-control" ng-model="branch" name="branchId"
id="branchId" name="branchId" style="width: auto;">
<option value="">Please Select Branch</option>
<option value="{{br.id}}"
ng-repeat="br in branches | orderBy:branchName">{{br.branchName}}</option>
</select>
</div>
</div>
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Checklist
Type:</label>
<div class="col-sm-6">
<input type="text" name="patientName" id="patientName"
style="margin: 0 auto;" data-provide="typeahead" data-items="4"
class="form-control"> <input type="hidden"
id="apptStartTime" /> <input type="hidden" id="apptEndTime" />
<input type="hidden" id="apptAllDay" />
</div>
</div>
<div class="form-group">
<label for="branch " class="col-sm-5 control-label2">Add
Recurrence Rule</label>
<div>
<input type="checkbox" name="isRecurrencePresent"
id="isRecurrencePresent" style="margin: 0 auto;"
data-provide="typeahead" data-items="4" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-primary" id="submitButton">Save</button>
</div>
</div>
日历已正确加载,模式对话框也已正确加载,但我无法在此模式中加载下拉列表好的,我已更改了您的导入,因为其中一些日历的顺序错误,因此现在我们在控制台上获得了一个完整的日历,没有错误。如果我理解正确,您想调用$scope.selectBranch=函数吗{…}并从$http获取所有早午餐?当ng change=selectBranch是触发器时?!但selectBrunch永远不会触发,因为该下拉列表中没有任何更改。在使用ng change之前,您需要加载您的“组织”
如果您想使用$http填充您的文件,您可以检查,希望它有帮助,如果您需要帮助,请让我知道。您可以制作一个plunker吗?plunker是一个plunker,但整个日历没有打开,需要很多时间。plunkr在添加pluginsyes@macrog方面有点新,但组织没有加载它是giving a injector:modulerr我已在body标记中注释了ng app,并在createEventModal div中删除了ng控制器