AngularJS ui-bootstrap打开模态窗口而不改变url
AngularJS ui-bootstrap open modal window without changing the url
我在AngularJS项目中使用ui-bootstrap模块。在我打开模式之前,url看起来像这样:localhost:58890/#/Project/46。打开它的代码在这里:
$modal.open(modalServices.newItemModal).result.then(function (name) {
var folder = new Item({
id: null,
projectId: ProjectService.project.ID,
name: name,
type: ItemType["Folder"],
contents : null
});
modalServices。newItemModal设置在这里:
var newItemModal = {
templateUrl: '/template/modal/newItem',
controller: 'NewItemController',
backdrop: 'static',
size : 'sm'
};
后面的代码行$modal。打开url更改为:localhost:58890/是否有可能防止这种情况,并使模态行为像在jQuery模态,它不改变url ?
如果你从锚标记调用你的模态打开函数,不要!
在视图中定义一个按钮,在on-click事件中,像这样触发open modal函数:
<button ng-click="openmodal()">OPEN MODAL</button>
app.controller('YourCtrl',function($scope,$modal){
$scope.openmodal=function(){
$modal.open(modalServices.newItemModal).result.then(function (name) {
var folder = new Item({
id: null,
projectId: ProjectService.project.ID,
name: name,
type: ItemType["Folder"],
contents : null
});
}
});
相关文章:
- angular ui路由器:创建可扩展的、不改变url的布局状态
- 另一个“;如何在不离开网页的情况下改变URL”;
- 如何改变url而不改变主干页面
- 正则表达式javascript改变url中的参数值
- 如何改变URL(哈希),当用户滚动或点击链接与jquery历史插件
- 如何用javascript改变URL的格式
- Angular的$compile正在改变URL
- 获取网页URL(移动到其他页面而不改变URL)
- AngularJS:改变URL,但不改变浏览器后退和前进按钮的控制器或模板加载
- 当改变url参数时,React路由器不会重新加载组件
- 流星路由器.即使页面转换,也不要改变Url
- 基于点击改变url
- JQuery Fancybox -试图改变url的图像一旦点击
- 有没有办法改变url是iframe
- 改变url的位置
- 改变url加载到javascript文件的根目录
- 方法:如何改变URL而不重新加载页面和索引整个URL(锚#部分)
- AngularJS ui-bootstrap打开模态窗口而不改变url
- 不改变URL的React Router
- 如何改变URl链接在我的Javascript