Angularjs $modal不';不能与内部html文件一起显示
$modal不会与内部html文件一起显示。 当我点击“添加”时,灰色窗口出现,但没有内部html内容。 我尝试放置一个像“”这样的外部url,但它成功了!。 我确实将该文件放在partials/dialog.html下。 我用的是离子框架 index.html:Angularjs $modal不';不能与内部html文件一起显示,angularjs,modal-dialog,angular-ui-bootstrap,ionic-framework,Angularjs,Modal Dialog,Angular Ui Bootstrap,Ionic Framework,$modal不会与内部html文件一起显示。 当我点击“添加”时,灰色窗口出现,但没有内部html内容。 我尝试放置一个像“”这样的外部url,但它成功了!。 我确实将该文件放在partials/dialog.html下。 我用的是离子框架 index.html: <!DOCTYPE html> <html ng-app="ionicApp"> <head> <meta charset="utf-8"> <meta nam
<!DOCTYPE html>
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Todo List App</title>
<!-- ionic css -->
<link href="lib/css/ionic.css" rel="stylesheet">
<!-- Bootstrap css -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- ionic/angularjs scripts -->
<script src="lib/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!--Angular-UI bootstrap script -->
<script src="js/ui-bootstrap-tpls-0.10.0.min.js"></script>
<!-- your app's script -->
<script src="js/angular-local-storage.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-controller="MyCtrl">
<header class="bar bar-header bar-positive">
<div class="buttons">
<button class="button button-icon icon ion-ios7-minus-outline" ng-click="showDelete = !showDelete"></button>
</div>
<h1 class="title">Todo List</h1>
<button class="button button-icon icon ion-ios7-bolt" ng-click="clearItems()"></button>
<button class="button button-icon icon ion-ios7-plus-outline" ng-click="addItem()"></button>
</header>
<ion-content class="has-header">
<ion-list show-delete="showDelete"
on-delete="onItemDelete(item)"
option-buttons="itemButtons">
<ion-item ng-repeat="item in items"
item="item"
href="#/item/{{item.id}}">
Item {{ item.id}}
</ion-item>
</ion-list>
</ion-content>
</body>
<!--</html>-->
待办事项列表应用程序
事項清單
项目{{Item.id}
app.js:
var myApp = angular.module('ionicApp', ['ionic', 'LocalStorageModule', 'ui.bootstrap']);
myApp.controller('MyCtrl', function($scope, $modal, localStorageService) {
$scope.items = [{id: 1}];
$scope.itemButtons = [
{
text: 'Edit',
type: 'button-assertive',
onTap: function(item) {
alert('Edit Item: ' + item.id);
}
},
{
text: 'Share',
type: 'button-calm',
onTap: function(item) {
alert('Share Item: ' + item.id);
}
}
];
$scope.onItemDelete = function(item) {
if (localStorageService.get('hey'))
{
var values = new Array();
values = localStorageService.get('hey');
var indexMy = values.indexOf(item);
values.splice(indexMy, 1);
localStorageService.add('hey', values);
}
//Remove the item from the GUI
$scope.items.splice($scope.items.indexOf(item), 1);
};
$scope.reloadItem = function() {
var values = new Array();
if (localStorageService.get('hey'))
{
values = localStorageService.get('hey');
var index;
for (index = 0; index < values.length; index++) {
$scope.items.push({id: values[index]});
}
}
};
$scope.clearItems = function() {
localStorageService.clearAll();
$scope.items = [];
};
$scope.reloadItem();
$scope.addItem = function() {
//Test - should be remove on release date
$scope.items.push({id : "sharon"});
var modalInstance = $modal.open({
templateUrl: 'partials/dialog.html',
controller: ModalInstanceCtrl
});
modalInstance.result.then(
function(newItemInput) {
var values = new Array();
if (localStorageService.get('hey'))
{
values = localStorageService.get('hey');
}
values.push(newItemInput);
//$scope.items.push({id : values[0]});
localStorageService.add('hey', values);
},
function() {
//$scope.lol = "no";
});
};
});
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.newItemObject = {};
$scope.ok = function() {
$modalInstance.close($scope.newItemObject.newItemInput);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
var myApp=angular.module('ionicApp',['ionic','LocalStorageModule','ui.bootstrap']);
控制器('MyCtrl',函数($scope,$modal,localStorageService){
$scope.items=[{id:1}];
$scope.itemButtons=[
{
文本:“编辑”,
键入:“按钮断言”,
onTap:功能(项目){
警报(“编辑项目:”+项目id);
}
},
{
文本:“共享”,
键入:“按钮冷静”,
onTap:功能(项目){
警报(“共享项目:”+项目id);
}
}
];
$scope.onItemDelete=功能(项目){
if(localStorageService.get('hey'))
{
var值=新数组();
values=localStorageService.get('hey');
var indexMy=值。indexOf(项目);
值。拼接(indexMy,1);
添加('hey',值);
}
//从GUI中删除该项
$scope.items.splice($scope.items.indexOf(item),1);
};
$scope.reloadItem=函数(){
var值=新数组();
if(localStorageService.get('hey'))
{
values=localStorageService.get('hey');
var指数;
对于(索引=0;索引
内部html“dialog.html”:
标题
输入您的新项目
嗯
取消
我遇到过引导css干扰ionic modals的问题,请尝试注释css/bootstrap.min.css
,看看是否有什么不同。我遇到过引导css干扰ionic modals的问题,试着注释掉css/bootstrap.min.css
,看看它是否有什么不同。我遇到过引导css干扰离子模态的问题,试着注释掉css/bootstrap.min.css
看看它是否有什么不同。我遇到过引导css干扰离子模态的问题,尝试注释出css/bootstrap.min.css
,看看它是否有任何区别。控制台错误?您使用的是http://还是文件://?没有错误,只是警告:event.returnValue已弃用。请改用标准的event.preventDefault()。NetBean以“”运行此项目,并且我将其部署在我的Nexus 4设备上,并且遇到相同的behaviorconsole错误?您使用的是http://还是文件://?没有错误,只是警告:event.returnValue已弃用。请改用标准的event.preventDefault()。NetBean以“”运行此项目,并且我将其部署在我的Nexus 4设备上,并且遇到相同的behaviorconsole错误?您使用的是http://还是文件://?没有错误,只是警告:event.returnValue已弃用。请改用标准的event.preventDefault()。NetBean以“”运行此项目,并且我将其部署在我的Nexus 4设备上,并且遇到相同的behaviorconsole错误?您使用的是http://还是文件://?没有错误,只是警告:event.returnValue已弃用。请改用标准的event.preventDefault()。NetBean以“”运行此项目,并且我将其部署在我的Nexus 4设备上,遇到了相同的行为
<html>
<head>
<title>title</title>
</head>
<body>
<div>
<p>Enter your new item</p>
<!-- <p><input type="text" ng-model="newItemObject.newItemInput" class="form-control" placeholder="Text input">{{newItemInput}}</p> -->
<p><button>OK</button>
<button>Cancel</button></p>
</div>
</body>
</html>