我是lodash的新手.我有这种json数据.我已经有90-120行代码解析它,对它进行一些计算,并创建新的json.它正在成为一场噩梦.
我想问一下如何使用lodash的方法来改变这个json.
[
{
"dates": [
{
"datetime": "2014-08-26",
"deviceModels": [
{
"deviceModel": "Canon450MX",
"devices": [
{
"deviceModel": "Canon450MX",
"inchesPrinted": 10,
"serialNum" : "111"
},
{
"deviceModel": "Canon450MX",
"inchesPrinted": 10,
"serialNum" : "222"
},
{
"deviceModel": "Canon450MX",
"inchesPrinted": 10,
"serialNum" : "333"
}
]
},
{
"deviceModel": "HPDeskjet",
"devices": [
{
"deviceModel": "HPDeskjet",
"inchesPrinted": 20,
"serialNum" : "444"
},
{
"deviceModel": "HPDeskjet",
"inchesPrinted": 20,
"serialNum" : "555"
}
]
}
]
},
{
"datetime": "2014-08-27",
"deviceModels": [
{
"deviceModel": …Run Code Online (Sandbox Code Playgroud) 我在$ scope.generateReport函数的开头调用这些代码,希望它一旦我点击按钮就会清除网格上当前显示的数据.不幸的是,它没有清除它.
我想通过使用未定义的值设置它,ui-grid会自动刷新自己,从而清除整个网格.
$scope.generateReport = function() {
$scope.gridOptions = {};
$scope.gridOptions.data = undefined;
$scope.gridOptions.columnDefs = undefined;
$scope.gridApi.grid.refresh();
........
}
// on my html template, I have a button that has an ng-click
// ng-click="generateReport()"
Run Code Online (Sandbox Code Playgroud) 我想我的AngularJS应用程序捕获"没有互联网连接",就像Chrome捕获它一样.当Chrome捕获它时,它会在console.log上显示net :: ERR_INTERNET_DISCONNECTED.
Angular的HTTP拦截器无法捕获它.我得到的唯一数据是rejection.data.status undefined rejection.status 0
我是Material-UI的新手。我尝试将菜单组件添加到我的项目中,并且能够显示它。菜单的背景是白色和黑色的文本颜色。我想更改颜色以匹配我的应用程序。
我从此链接复制了工作组件代码-http: //www.material-ui.com/#/components/menu
我一直在向我的样式对象的不同部分添加backgroundColor,但是没有运气
import React from 'react';
import Menu from 'material-ui/lib/menus/menu';
import MenuItem from 'material-ui/lib/menus/menu-item';
import Divider from 'material-ui/lib/divider';
import FontIcon from 'material-ui/lib/font-icon';
import ContentCopy from 'material-ui/lib/svg-icons/content/content-copy';
import ContentLink from 'material-ui/lib/svg-icons/content/link';
import Delete from 'material-ui/lib/svg-icons/action/delete';
import Download from 'material-ui/lib/svg-icons/file/file-download';
import PersonAdd from 'material-ui/lib/svg-icons/social/person-add';
import RemoveRedEye from 'material-ui/lib/svg-icons/image/remove-red-eye';
const style = {
menu: {
marginRight: 32,
marginBottom: 32,
float: 'left',
position: 'relative',
zIndex: 0,
width: 235,
},
rightIcon: {
textAlign: 'center',
lineHeight: '24px',
},
bg: {
backgroundColor: '#364150',
color: 'white' …Run Code Online (Sandbox Code Playgroud) 当我单击导出按钮时,它会对我们的端点进行REST调用,然后几秒钟后,我收到响应,然后我也会渲染表.不幸的是,我读到每个调用都是异步的,这意味着即使表还没有呈现,我的期望也会被执行.期望我写了检查字符串是否在桌子上,但它失败了,因为它还没有.对此有什么正确的解决方法?
it('should generate global user report', function() {
element(by.css('button#exportButton')).click();
expect(element(by.css("th[name*=Date]")).getText()).
toEqual('Date');
})
Run Code Online (Sandbox Code Playgroud)
控制台上的错误是
NoSuchElementError: No element found using locator: By.cssSelector("th[name*=Date]")
Run Code Online (Sandbox Code Playgroud)
我注意到表还没有呈现,这就是它失败的原因.
我需要“gulpserve”在我添加到主机文件中的主机名(而不是本地主机)上为我的应用程序提供服务。我这样做是出于 cookie 的原因,因为每次添加 cookie 时我都会添加域密钥。
例如 127.0.0.1 app1.example.org
当我启动“gulpserve”时,它会触发网络浏览器并输入http://app1.example.org:3000或它正在运行的任何 TCP 端口。
它通过ui-sref调用时有效
<a class="button" ui-sref="main.create">
Run Code Online (Sandbox Code Playgroud)
但是当使用ng-click和$ stage.go调用它时,它被调用并呈现页面但我的$ urlRouterProvider.otherwise将再次覆盖DOM.我在逐步调试时注意到了它.它可能认为main.create是一个不存在的url.
这是ng-click的代码和功能.
<a href="#" ng-click="create()">Create Object</a>
Run Code Online (Sandbox Code Playgroud)
这是create()函数
$scope.create = function() {
$state.go('main.create');
};
Run Code Online (Sandbox Code Playgroud)
它$state.go('main')在ng-click="create()"使用时调用.但在调用之前$state.go('main'),我在DOM中看到了正确的main.create页面呈现.我编写了"IF"语句来处理不存在的url,以便将它们重定向回主页.这是我的config.js.
.state('main', {
url: '/',
views: {
'@': {
templateUrl: 'app/main/main.html',
controller: 'MainController'
},
'content@main' : {
templateUrl: 'app/main/main.display.html'
}
}
})
.state('main.create', {
url: '/create',
views: {
'content@main' : {
templateUrl: 'app/main/main.create.html'
}
}
})
$urlRouterProvider.otherwise(function ($injector) {
var Session = $injector.get('Session');
var $state = $injector.get('$state');
if (Session.isAuthenticated()) {
$state.go('main'); // <-- this is …Run Code Online (Sandbox Code Playgroud) 我还想使用ng-repeat显示键"scott"和"bill"及其所有属性值(fullname和age).
{
"attributes": {
"scott": {
"fullname": "Scott D Man",
"age": "string"
},
"bill": {
"fullname": "William Shatner",
"age": "string"
}
},
"id": "HJK321",
"reportDate": "20150719"
}
Run Code Online (Sandbox Code Playgroud) 我对 gdb 很陌生。我写了一个非常简单的hello world程序
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我编译它-g以添加调试符号
gcc -g -o hello hello.c
Run Code Online (Sandbox Code Playgroud)
由于我不熟悉 gdb,因此我不确定接下来要做什么。我希望能够使用 gdb 来检查汇编代码。这就是我在 IRC 上被告知的。
angularjs ×5
javascript ×2
assembly ×1
c ×1
css ×1
dns ×1
e2e-testing ×1
gcc ×1
gdb ×1
gulp ×1
json ×1
lodash ×1
material-ui ×1
nested ×1
ng-repeat ×1
protractor ×1
selenium ×1
testing ×1