我对ES6课程有很多疑问.
因为我了解如何使用函数和WebComponent,React等.我没有看到使用它的许多好处.
我想知道使用类的好处是什么.我读到public/private/static将成为ES7的一部分.所以我认为目前没有必要使用它.
此外,类是OOP的概念还是它仍然是一个'javascript对象概念'?这是否意味着我不能使用它来修改它class?或者它只是相同的对象,但有两种不同的方式来声明它.
速度有好处吗?如果你有一个像Big Java app这样的大型应用程序,可能更容易维护/理解?
class
信息:这个问题现在是3个半哟.由于TJ Crowder,答案仍然准确.但是Javascript已经发展了很多!风险自负.
我正在使用angular nvd3指令.
根据例子:https://github.com/angularjs-nvd3-directives/angularjs-nvd3-directives/blob/master/examples/lineChart.with.automatic.resize.html
<!--
width and height are removed from the directive for automatic resizing.
-->
Run Code Online (Sandbox Code Playgroud)
好吧,如果我更改图表的Div大小.它调整大小,但只有当我移动/打开/关闭'控制台视图'(FF上ctrl+ shift+ i)时.
我检查了angular-nvd3-directive,调整大小没有事件调用,所以我想这是一个d3/nvd3 comportement?
到目前为止我的问题:如何模拟这种事件以使图形调整大小?
我发现了一些关于使用angular进行身份验证的代码,我无法理解这个技巧:
authService.isAuthenticated = function () {
return !!Session.userId;
};
Run Code Online (Sandbox Code Playgroud)
什么!!意思是"userId的不同"?
无论何时true = !!true = !!!!true =>etc,它都不明白这一点.
有人可以帮帮我吗?
(https://medium.com/opinionated-angularjs/techniques-for-authentication-in-angularjs-applications-7bbf0346acec为源,部分'AuthService')
----编辑问题是漫长而难以理解------
这是一个工作的例子:http://codepen.io/anon/pen/Mwapgb 警告:这将使firefox崩溃!,如果你敢,在任何div上点击大约500次(我建议使用工具来模拟它.翻录鼠标)
但是这个http://codepen.io/anon/pen/eNNqde 不会让firefox崩溃
有什么不同 :
function GetDateFromDatetimePython(stringdate){ // IT CRASH
var partieDate = stringdate.split(' ');
var ymd = partieDate[0].split('-');
var hms = partieDate[1].split(':');
return new Date(Date.UTC(ymd[0],ymd[1]-1,ymd[2],hms[0],hms[1],hms[2],0));
}
function GetDateFromDatetimePython(stringdate){ // IT DON'T
var partieDate = stringdate.split(' ');
var tmp = partieDate[0]; // add this
var tmp2 = partieDate[1]; // add this
var ymd = tmp.split('-'); // change this
var hms = tmp2.split(':'); // change this
return new Date(Date.UTC(ymd[0],ymd[1]-1,ymd[2],hms[0],hms[1],hms[2],0));
}
Run Code Online (Sandbox Code Playgroud)
我要疯了.第一次练习有什么问题?
好吧,让3分裂是愚蠢的,我可以合并为1.每当.为什么这会炸毁firefox,为什么Chrome和IE都没有影响呢?
我有两个引导表垂直显示。它们包含相同的标题标题,但单元格上的内容长度是可变的。
最终结果看起来很可悲,我想让那些表格列对齐“因为”它是一个非常大的表格,让用户可以轻松阅读(例如这里):https : //jsfiddle.net/5qn79j4f/1/
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead>
<tr>
<td class="table-colspan" colspan="6">Wednesday</td>
</tr>
</thead>
<tr class="title-tr">
<td>yolo</td>
<td>2</td>
<td>x</td>
<td>x</td>
<td>5</td>
<td>x</td>
</tr>
<tr>
<td>yolo</td>
<td>yolo swag f*ck*** long content</td>
<td>qwe</td>
<td>qwe</td>
<td>qwe.</td>
<td>qwe</td>
</tr>
</table>
</div>
</div>
<div class="col-sm-12">
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead>
<tr>
<td class="table-colspan" colspan="6">later on</td>
</tr>
</thead>
<tr class="title-tr">
<td>yolo</td>
<td>2</td>
<td>x</td>
<td>x</td>
<td>5</td>
<td>x</td>
</tr>
<tr>
<td>qwe</td>
<td>qwe</td>
<td>qwe</td>
<td>qwe</td>
<td>this one will be …Run Code Online (Sandbox Code Playgroud) 我对角度点击事件系统有疑问。
<div class="login__visiblePasswd">
<a md-mini-fab (click)="togglePassword($event)" (mouseout)="setMdpPassword()"><md-icon>visibility</md-icon></a>
</div>Run Code Online (Sandbox Code Playgroud)
我有一个按钮,单击时显示密码并在鼠标移开时将其隐藏。我真正需要的是“单击开始”调用方法切换密码,然后“单击释放”将其隐藏回来。到目前为止我找不到任何 (clickstart) (clickrelease) 事件。默认情况下,(单击)事件仅在用户释放鼠标按钮时触发。
您知道如何通过事件/其他选项解决该问题吗?
为了避免导入文件时出现相对路径,我尝试配置angular来理解路径。
到目前为止,我的代码根本不起作用:
//tsconfig.app.json
"compilerOptions":{
//lot of things . If it matter moduleResultion is set to node
"baseUrl": ".",
"paths": {
"@modules": ["app/modules/"]
...
},
}
//in a component:
import { X } from '@modules/Y/component/index'
Run Code Online (Sandbox Code Playgroud)
运行ng serve时,控制台输出以下错误: : Cannot find module '@modules/Y/component/index'.
这肯定是在使用相对路径 import { X } from ../../../modules/Y/component/index
因此,我希望我的tsconfig.app.json或tsconfig.json(或可能两者都出错)是错误的,但是,我找不到关于如何正确地为角度应用程序做任何好的教程。
当前将angular 4与基本的关联工具结合使用(打字稿2.3.3,angular-cli 1.0.6并提供webpack)
您能向我指出问题,还是请给我一个好的文档/教程,请用angular解决这个问题?到目前为止,我在SO或github问题上看到的所有答案都根本不起作用。
注意:体系结构看起来像这样
project
|
-tsconfig.json //had try things on this one too but does nothing.
-src/
|
-tsconfig.app.json
-app/
|
-modules
-othersFolder
Run Code Online (Sandbox Code Playgroud) javascript ×4
angularjs ×3
angular ×2
angular-cli ×1
css ×1
ecmascript-6 ×1
firefox ×1
garbage ×1
html ×1
nvd3.js ×1
typescript ×1
webpack ×1