小编maX*_*maX的帖子

如何通过递归要求访问父指令的控制器?

我试图以递归方式到达父"box"指令的控制器:

<body ng-app="main">

<!-- no nesting: parent is the just body -->
<box></box>

<script type="text/javascript">
angular.module('main', [])
.directive('box', function() {
    return {
        restrict: 'E',
        controller: function() { },
        require: '?^box',  // find optional PARENT "box" directive
        link: function(scope, iElement, iAttrs, controller) {
            // controller should be undefined, as there is no parent box
            alert('Controller found: ' + (controller !== undefined));
        }
    };
});
</script>
</body>
Run Code Online (Sandbox Code Playgroud)

我希望控制器变量undefined在链接函数中,但我得到实际box指令的控制器.

所以我的问题是......在这种情况下如何访问PARENT控制器:

<box>
    <box></box>
</box>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/gjv9g/1/

angularjs angularjs-directive angularjs-controller

20
推荐指数
2
解决办法
2万
查看次数

源映射HTTP请求不发送cookie标头

关于源映射,我在chrome中遇到了一个奇怪的行为(build 181620).在我的应用程序中,我使用缩小的jquery,登录后,我开始在服务器日志文件中看到"jquery.min.map"的HTTP请求.这些请求缺少cookie头(所有其他请求都没问题).这些请求甚至没有暴露在开发人员工具的网络标签中(这不会让我感到烦恼).

关键是,这个应用程序中的js文件只能用于登录客户端,因此在此设置中,源映射要么不起作用,要么我必须将源映射的位置更改为公共目录.

我的问题是:这是一个理想的行为(意思是 - 源地图请求不应该发送cookie)或者它是Chromium中的错误?

javascript cookies google-chrome-devtools source-maps

6
推荐指数
1
解决办法
888
查看次数