在某些时候,我不知道你们是否称它为REPL驱动的开发或其他东西,但我发现自己通过binding.pry在某个测试中插入一个调用来检查我的运行时的内容.这很好用,除非我正在运行Cucumber测试,因为我选择poltergeist了我的capybara驱动程序,它使用phantomjs.我可以让REPL启动,但是经过一段时间它被杀死了,我得到一个超时错误phantomjs,我想知道是否有办法解决这个问题,即使它包括切换到pry-remote或类似.这可能是之前被问过但我找不到答案.线索?
我正在努力解决这个问题.评级是Angular Bootstrap的一个指令,我无法控制,我可以定义一个控制器,我试图通过它序列化评级,但我似乎无法访问父文章.我是AngularJS的新手,所以这可能是最愚蠢的问题,但我正在尝试$scope.$parent,这确实让我可以访问一个article属性,但当我这样做$scope.$parent.article时返回undefined,必须有另一种方式.
这是有问题的标记:
<div class="article full" data-ng-model="article">
<header class="page-header">
<h4>{{article.title}}</h4>
<div class="article-rating" rating ng-controller="RatingsCtrl" value="article.rating" max="5"></div>
</header>
<!-- ... -->
</div>
Run Code Online (Sandbox Code Playgroud)
这是有问题的指令https://github.com/angular-ui/bootstrap/blob/master/src/rating/rating.js,这是我试图让某些东西起作用,这不会增加太多上下文,但按要求:
angular.module("myApp")
.controller("RatingsCtrl", ($scope) ->
console.log $scope.$parent.article #=> undefined
$scope.$watch 'value', (newVal, oldVal) ->
console.log "newVal = #{newVal} oldVal=#{oldVal}"
console.log $scope.$parent.article #=> undefined
)
Run Code Online (Sandbox Code Playgroud) javascript twitter-bootstrap angularjs angularjs-directive angularjs-scope