我正在尝试在现有指令的基础上构建一个新指令,但我在我的过程中停止了.加载页面时,我遇到以下错误:
多指令[指令#1,指令#2]要求隔离范围
<easymodal title="Test-Title" text="Text-Text" oncancel="show = false" onok="alert();">
基本指令如下所示:
Rohan.directive('easymodal', function () {
return {
restrict: 'E',
// priority: 200,
transclude: true,
replace: true,
scope:{
showModal: "=show",
callback: "=closeFunction",
dismissable: '&'
},
template:
'<div data-ng-show="showModal" class="modal-container">' +
'<div class="modal-body">' +
'<div class="title"><span data-translate></span><a data-ng-show="dismissable" data-ng-click="dismiss()">x</a></div>' +
'<div data-ng-transclude></div>' +
'</div>' +
'<div class="modal-backdrop" data-ng-click="dismiss()"></div>' +
'</div>'
};
});
Run Code Online (Sandbox Code Playgroud)
我的包装器指令看起来像这样:
Rohan.directive('easydialog', function () {
return {
restrict: 'E',
transclude: true,
scope: {title: '@',
text: '@',
onOk: '&',
onCancel: '&'},
replace: …
Run Code Online (Sandbox Code Playgroud) 我的问题如下:
我正在向通知栏发布通知,并且我已经在其中发送了一个URI链接.一旦我点击通知我得到一个对话框我想做什么,但它显示垃圾,如应用程序信息,条形码扫描仪,调用对话框.而不是浏览器.
我提出我的代码:
Intent notificationIntent = new Intent(Intent.ACTION_VIEW);
PendingIntent contentIntent = PendingIntent.getActivity(contexta, 0, notificationIntent, 0);
notificationIntent.setData(Uri.parse("http://www.google.com"));
notification.setLatestEventInfo(contexta, contentTitle, contentText, contentIntent);
mNotificationManager.notify(970970, notification);
Run Code Online (Sandbox Code Playgroud)
所以我可能没想到正确的方向.我是否应该插入一个intent并在我自己的应用程序中有一个处理程序而是为浏览器创建一个新的意图?但那会很奇怪,为什么android无法正确处理我的初始意图呢.
一如既往,非常感谢任何和所有的帮助.
谢谢,罗汉.
因此,在下面的代码中,我将指向匿名go函数的指针传递给了函数,但代码的行为并不像我期望的那样.
package main
import "fmt"
type (
Element struct{
Name string
}
)
func main() {
elements := []Element{{"first"}, {"second"}, {"third"}, {"fourth"}}
waiting := make(chan bool)
for _, element := range elements {
go func(element *Element){
fmt.Println("Element Name: ", element.Name)
waiting <- true
}(&element)
}
for i := 0; i < 4; i++{
<- waiting
}
}
Run Code Online (Sandbox Code Playgroud)
我希望代码写:
以任何顺序,但它是打印:
因此,似乎匿名go函数'解析'它的*Element参数到当时该循环中的任何内容,所以这个代码将通过传递Element {}本身而不是指向元素的指针来修复.
我的问题是:
操场:
http://play.golang.org/p/tcRvforQE4
编辑:问题格式