我正在创建一个基于移动的网页,我正在使用Web套接字连接来处理聊天室.但是我希望每次用户通过移动浏览器访问网页时都会打开显示屏.
我试图模拟Button Click from,
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
Run Code Online (Sandbox Code Playgroud)
但是特定时间后移动显示屏仍会关闭.请任何人可以帮助我吗?
更新11/1/15
从Alpha 45开始,Aux Routes不受支持. 链接到Github问题
@ evan-plaice的道具
原始问题
我在Angular2路由器上观看了Brian Ford的演讲:https://youtu.be/z1NB-HG0ZH4
我开始尝试使用"Aux"路由,我的代码丢失了很多错误.
我在mgechev的Angular Seed的Alpha 44上
在我的app.ts组件中,它非常标准,因为RouteConfig我有:
@RouteConfig([
{ path: '/', component: HomeCmp, as: 'Home' },
{ path: '/run', component: RunCmp, as: 'Run' },
{ path: '/manage', component: ManageCmp, as: 'Manage' },
{ path: '/user', component: UserCmp, as: 'User' },
{ path: '/settings', component: LocalSettingsCmp, as: 'Settings' },
{ aux: '/login', component: LoginCmp, as: 'Login' }
])
Run Code Online (Sandbox Code Playgroud)
我的app.html:
<div id="main-content" class="full">
<router-outlet></router-outlet>
<router-outlet name="login"></router-outlet>
</div> …Run Code Online (Sandbox Code Playgroud) 我已经Dockerfile用我的所有配置创建了一个。
最后我想运行一个 python 服务器python server.py
以及一个节点服务器npm start
因为我可以拥有一台CMD,或者ENTRYPOINT如何在docker run执行时启动这两台服务器?
docker 推荐的处理此类情况的方法是什么?
我正在使用AFNetworking将rss feed图像集下载到表视图.以下是我正在使用的代码.
- (UITableViewCell *)tableView:(UITableview *)tableView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
{
Cell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"MY_CELL" forIndexPath:indexPath];
NSString *wallpaperLink = [af setThumbString:[[feeds objectAtIndex:indexPath.row] objectForKey: @"wallpaper"]];
//AfNetwork Download
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:wallpaperLink]]];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
//Set Cell Image from response
cell.imageView.image = responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Image error: %@", error);
}];
[requestOperation start];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但是当我浏览一些教程时,我意识到这不是使用AFNetworking下载异步图像的方法.有人可以告诉我我的代码,如何下载并添加responseobject到cell.imageView.image???
我正在关注的Angular.io documenation一旦应用程序在浏览器中运行,角2抛出一个写有角2.一个简单的"Hello World"应用程序TypeError从angular2/src/browser_adapter.js.
一切似乎都正确设置.知道问题是什么吗?
安慰:
TypeError: Array.from is not a function
at createArrayFromMap (http://localhost:3000/node_modules/angular2/src/facade/collection.js:61:42)
at Function.MapWrapper.values (http://localhost:3000/node_modules/angular2/src/facade/collection.js:100:47)
at _createListOfBindings (http://localhost:3000/node_modules/angular2/src/di/injector.js:769:36)
at Function.Injector.resolve (http://localhost:3000/node_modules/angular2/src/di/injector.js:403:16)
at Function.Injector.resolveAndCreate (http://localhost:3000/node_modules/angular2/src/di/injector.js:420:41)
at _createAppInjector (http://localhost:3000/node_modules/angular2/src/core/application_common.js:291:39)
at http://localhost:3000/node_modules/angular2/src/core/application_common.js:257:31
at Zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2.js:118:17)
at Zone.run (http://localhost:3000/node_modules/angular2/src/core/zone/ng_zone.js:165:42)
at NgZone.run (http://localhost:3000/node_modules/angular2/src/core/zone/ng_zone.js:112:40)BrowserDomAdapter.logError @ :3000/node_modules/angular2/src/dom/browser_adapter.js:71
Run Code Online (Sandbox Code Playgroud)
all.babel.js(符合es5 all.js):
import {Component, View, bootstrap} from 'angular2/angular2'
@Component({
selector: 'helloworld'
})
@View({
template: `<h1>Hello World!</h1>`
})
class HelloWorld {
}
bootstrap(HelloWorld)
Run Code Online (Sandbox Code Playgroud)
index.html的:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Angular 2 Hello World</title> …Run Code Online (Sandbox Code Playgroud) 假设我有一些父组件,调用它MatchList,它提供了一个Hero对象列表,以及其他内容.每个Hero对象都具有某些表中显示的属性.现在假设我也有每一个按钮Hero是更新路线,加载一个新的视图,并显示出更多的细节.
之前
后
我的问题必不可少的是:我想navigate()从MatchList模板中的按钮调用路由器的方法,但是当我尝试这样做时收到以下错误:
EXCEPTION:评估"click"时出错BrowserDomAdapter.logError @ ... angular2.dev.js:21835 ORIGINAL EXCEPTION:TypeError:l_context.setPath不是函数... angular2.dev.js:21835 TypeError:l_context.setPath不是...的功能
换句话说,看起来我无法在子模板中引用父组件的路由器方法.
那么,对于子组件访问父组件(或"上下文")的方法,Angular 2中的正确和最佳方法是什么?
如果解决方案更清洁,我更愿意
class parent {
child: Child;
constructor(...) {
...
this.child.parent = this;
}
}
Run Code Online (Sandbox Code Playgroud)
编辑 我将模板按钮更改为
(^click)="setPath(match.match_id)"
Run Code Online (Sandbox Code Playgroud)
我不再收到错误消息,但没有任何反应 - 我甚至没有得到确认点击的控制台日志.
到目前为止我所拥有的片段.
//父
@Component({
selector: 'dota-app',
directives: [Home, MatchesView, ROUTER_DIRECTIVES],
templateUrl: 'AppView.html'
})
@RouteConfig([
{ path: '/', component: Home, as: 'Home' },
{ path: '/matches', component: …Run Code Online (Sandbox Code Playgroud) 我的假设场景是这样的:
现在我的 git diff 和 jacoco 信息的交集是覆盖了更改的 10 行代码中的 7 行。即 - 我对新代码有 70% 的覆盖率。
但我必须手动解决这个问题。
我想要一种自动化的方法来计算覆盖了多少新代码行的百分比。
我的问题是:有没有办法只在新代码上获得单位覆盖率(例如来自 jacoco)?
(请注意,如果您运行扫描仪并使用 JSON API 询问任务结果,我知道sonarqube可以做到这一点analysis.mode=publish- 我正在寻找开发人员可以在本地运行的轻量级东西。)
我正在一个项目中使用Angular 2和NodeJS和TypeScript。
Angular2使用装饰器定义组件。我希望能够以相同的方式在域对象上表达验证逻辑。这将很有用,因为我可以一次表达一次验证规则,并将其用于服务器端和客户端。
而不是像这样在标记中表达必填字段:
<input required [(ng-model)]="selectedHero.name"></input>
Run Code Online (Sandbox Code Playgroud)
我想这样做:
class Hero {
id: number;
@Required
name: string;
}
Run Code Online (Sandbox Code Playgroud)
我试图弄清楚如何编写指令以读取元数据,以便将必需的属性应用于输入元素以及在NodeJS中创建验证错误。任何指导表示赞赏。谢谢您的帮助。
我已经使用angular2(升级选项)将angular1应用程序升级为bootstrap,但在使用systemJS config导入angular后:
map: {... 'angular': 'npm:angular/angular.js' ... }
Run Code Online (Sandbox Code Playgroud)
浏览器发送错误:
systemjs.import error: Error: (SystemJS) angular.module is not a function
TypeError: angular.module is not a function
at execute (http://msoqa05.devlab.ad:8088/home/bl/app.module.js:88:21)
at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4?main=browser:242:26)
at Zone.run (https://unpkg.com/zone.js@0.7.4?main=browser:113:43)
at https://unpkg.com/zone.js@0.7.4?main=browser:520:57
at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4?main=browser:275:35)
at Zone.runTask (https://unpkg.com/zone.js@0.7.4?main=browser:151:47)
at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4?main=browser:418:35)
at XMLHttpRequest.ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4?main=browser:349:25)
Error loading http://msoqa05.devlab.ad:8088/home/bl/app.module.js
Run Code Online (Sandbox Code Playgroud)
也许我不理解它,但为了导入角度我需要在systemjs.config中映射它?为什么?
我正在尝试降级app.module.ts中的angular2 componentsnet:
import * as angular from 'angular';
import { downgradeComponent } from '@angular/upgrade/static';
angular.module('myApp')
.directive(
'helloWorld',
downgradeComponent({component: HelloWorldComponent}) as angular.IDirectiveFactory
);
Run Code Online (Sandbox Code Playgroud)
ts编译没问题,但浏览器不能正常使用它我得到了这个错误.angular.module是angularJS的基础?
angular ×5
javascript ×4
typescript ×2
address-bar ×1
afnetworking ×1
docker ×1
dockerfile ×1
ios ×1
jacoco ×1
macos ×1
objective-c ×1
router ×1
systemjs ×1
uitableview ×1
unit-testing ×1