0
对于我的应用程序,我想在用户单击标题中的登录按钮时显示一个模式窗口。我尝试使用angular-ui bootstrap standalone的例子,它工作正常。yeoman angular fullstack -modal
但是,当我与yeoman-angular-fullstack集成时,我无法获得modal.Also并没有在grunt测试和我的开发工具中显示任何错误。 请帮忙解决这个
对于我的应用程序,我想在用户单击标题中的登录按钮时显示一个模式窗口。我尝试使用angular-ui bootstrap standalone的例子,它工作正常。yeoman angular fullstack -modal
但是,当我与yeoman-angular-fullstack集成时,我无法获得modal.Also并没有在grunt测试和我的开发工具中显示任何错误。 请帮忙解决这个
这样,这是我做了什么:
在navbar.html:
<li ng-hide="nav.isLoggedIn()" ui-sref-active="active"><a ng-click=openSignUp() href>Sign up</a></li>
在navbar.controller.js:
$scope.openSignUp = function(){
signupTemplate.openSignUpModal();
};
我正在使用名为的创建服务signupT emplate,这可能是有用的。
在我的服务signupTemplate:
angular.module('myApp')
.service('signupTemplate',['$uibModal', function ($uibModal) {
self.dataForModal={
// yourData: here,
};
this.openSignUpModal = function() {
var modalInstance = $uibModal.open({
animation: true
template: '<your-component modal-data="$ctrl.modalData"></your-component>'
controller: ['modalData', function(modalData) {
var $ctrl=this;
$ctrl.modalData = modalData;
}],
controllerAs:'$ctrl',
resolve: {
modalData: self.dataForModal
}
};
}]);
要从父母那里的模式被称为你的模式发送数据,你必须把你的数据在dataForModal。
而要关闭并访问组件中的数据,则必须将其绑定。
在yourComponent.component.js
bindings:{
modalData:'<',
$close: '&',
}
确保咕噜不去除您的index.html文件的角度引导资源,有可能它没有得到包含在构建 –
我检查指标.html,它显示角度bootstrap.The单独模式不工作。它将我重定向到新的空白窗口。我试着咕噜混到false。如何检查modal指令是否与我的yeoman角度堆栈兼容。我GOOGLE了很多,并尝试所有修复。但没有什么工作。以下是我的角引导版本 “angular”:“> = 1.2。*”, “bootstrap”:“〜3.1.1”, “angular-bootstrap”:“〜0.11.0”, “ ui-router“:”〜0.2.10“ – yeomane
你可以用你的index.html和你的页面有一个模式 –