我正在构建一个角度的应用程序,它使用不同的API并给用户选择它的选项将被记录并发送回服务器.
我的设计如下.
Run Code Online (Sandbox Code Playgroud)MainController { $scope.loaded = DataService.get(); $scope.userOptions = {}; $scope.$on('update',function(){ updateUserOptions(); }) } ChildController { $scope.loaded.then(function(){ //all logic of child controller } $scope.onselect = function(){ $scope.$emit('update',data); } }
问题
我通过编写布局并在我的活动中对其进行充气,为我的活动创建了一个菜单.当我写了onOptionItemSelected从事件监听器收到的Rid并且我来自R.id.menu不同的事件时我点击了正确的菜单项.它比实际小一位数.所以我的点击功能不起作用?
下面的页面有一个示例,用于委托$ log in angular的调试功能.
http://solutionoptimist.com/2013/10/07/enhance-angularjs-logging-using-decorators/
同样,我想委托$ http服务的get/post功能.这样我就可以记录我的应用程序所做的所有请求.
以下是我的代码
$provide.decorator('$http', ["$delegate", function($delegate) {
var debugFn = $delegate.get;
$delegate.get = function() {
var args = [].slice.call(arguments);
// Prepend timestamp
console.log(args[0]);
// Call the original with the output prepended with formatted timestamp
debugFn.apply(null, args)
};
return $delegate;
}]);
Run Code Online (Sandbox Code Playgroud)
即使它正在记录url,它也会抛出异常
TypeError: Cannot read property 'finally' of undefined
at handleRequestFn (angular.js:17382)
at compileTemplateUrl (angular.js:8270)
at applyDirectivesToNode (angular.js:7885)
at compileNodes (angular.js:7431)
at compile (angular.js:7338)
at applyDirectivesToNode (angular.js:7808)
at compileNodes (angular.js:7431)
at compileNodes (angular.js:7443)
at compile (angular.js:7338) …Run Code Online (Sandbox Code Playgroud) 如何通过python读取两行中输入的两个值到两个变量,例如%d%d in c raw_input读取该行中的所有内容
例如1 0
我想要1英寸x和0英寸y
我的HTML是跟随
<ul id="ul1">
<li>
content1
</li>
</ul>
<ul id="ul2">
<li>
content2
</li>
</ul>
<ul id="ul3">
<li>
content3
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
编辑
我需要这些li的内容在数组中如何在jQuery中执行此操作
array['ul1']='content1'
array['ul2']='content3'
Run Code Online (Sandbox Code Playgroud)