是否可以使用单例控制器获得多个视图[ https://github.com/angular-ui/ui-router/issues/494]?
使用案例:我有一个ui-view = header和ui-view = content.我根据当前状态更改标题以显示上下文相关按钮(即返回,保存,过滤等)我希望这些按钮在内容控制器中调用函数,但如果我执行以下操作,则会创建两个MyController对象.如果有任何init函数,它们会被调用两次,这在大多数情况下是对我的服务器的查询的两倍.
views:{
'header':{
templateURL:'...',
controller:'MyController'
},
'content':{
templateURL:'...',
controller:'MyController'
}
}
Run Code Online (Sandbox Code Playgroud)
更新:基于@pankajparkar
我当前的index.html看起来像这样(为了理解而简化)
<nav ui-view="header"></nav>
<div ui-view="content"></div>
Run Code Online (Sandbox Code Playgroud)
但你的建议包括/ REQUIRE子视图
<!--index.html-->
<body ui-view></body>
<!--format.html-->
<nav ui-view="header"></nav>
<div ui-view="content"></div>
Run Code Online (Sandbox Code Playgroud)
使用以下控制器
state('app', {
url: '/app',
controller: 'MyController',
templateURL: 'format.html', //Targets ui-view in index.html
views:{
'header':{
templateURL:'...', //Targets ui-view="header" in format.html
},
'content':{
templateURL:'...', //Targets ui-view="header" in content.html
}
}
});
Run Code Online (Sandbox Code Playgroud) 我认为错误是我的postfix配置的问题.我按照这里的说明中的步骤设置了apache/postfix/mailman.
真实域名被mydomain.com取代 我创建了一个名为mailman的默认邮件列表.当我向mailman@mydomain.com发送电子邮件时,我在mail.log中收到错误"收件人地址被拒绝:本地收件人表中的用户未知".
550 5.1.1 <mailman@mydomain.com>: Recipient address rejected: User unknown in local recipient table; from=<-----@gmail.com> to=<mailman@mydomain.com> proto=ESMTP helo=<mail-wi0-f174.google.com>
Run Code Online (Sandbox Code Playgroud)
摘自我的postfix/main.cf:
myhostname = mydomain.com
mydestination = mydomain.com, localhost
inet_protocols = ipv4
relay_domains = mydomain.com
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1
Run Code Online (Sandbox Code Playgroud)
摘自/ etc/postfix/transport
mydomain.com mailman:
Run Code Online (Sandbox Code Playgroud)
摘自postfix/master.cf
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
Run Code Online (Sandbox Code Playgroud)
如果我理解它应该如何工作......