我的页面中包含省略号的动态数据.含义:
.my-class
{
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 71px;
}
Run Code Online (Sandbox Code Playgroud)
并且我想添加具有相同内容的此元素工具提示(title ='$ {myData}')但我希望它仅在内容很长并且省略号出现在屏幕上时才会出现.
有什么办法吗?
一个方向 - 当浏览器(在我的情况下是IE)绘制省略号时 - 它会抛出一个关于它的事件吗?
这似乎很简单,但我找不到任何解决方案.
那么,我如何检查我的应用程序是在生产模式还是开发模式下运行?
如何检查数组是否具有重复值?
如果数组中的某些元素相同,则返回true.否则,返回false.
['hello','goodbye','hey'] //return false because no duplicates exist
['hello','goodbye','hello'] // return true because duplicates exist
Run Code Online (Sandbox Code Playgroud) 我想限制两个值之间的数字,我知道在PHP中你可以这样做:
$number = min(max(intval($number), 1), 20);
// this will make $number 1 if it's lower than 1, and 20 if it's higher than 20
Run Code Online (Sandbox Code Playgroud)
如何在javascript中执行此操作,而不必编写多个if语句和类似的东西?谢谢.
我正在开展Angular项目.我正在努力应对组件中的刷新操作.
我想在按钮点击时刷新路由器的组件.当我点击它时,我有刷新按钮需要刷新组件/路由器.
我试过window.location.reload(),location.reload()这两个不适合我的需要.如果有人知道,请帮忙.
我的页面结构是:
<app-header></app-header>
<router-outlet></router-outlet>
<app-footer></app-footer>
Run Code Online (Sandbox Code Playgroud)
如何在app-header不刷新整个页面的情况下更新/刷新组件?
我想在用户成功登录后隐藏标题中的"登录"链接.标题在所有组件/路由中都很常见.
我正在寻找一个Notepad ++的插件,它将自动对齐(自动格式化)我的Css文件.类似于visual studio ctrl + k,ctrl + d只对记事本++有效.
有人知道这样的事吗? 
我刚刚将我的项目从angular v5.x迁移到v6.x,现在当我尝试启动它时,ng serve我得到了:
Cannot find module 'webpack'
Error: Cannot find module 'webpack'
at Function.Module....
Run Code Online (Sandbox Code Playgroud)
任何帮助?
我清除了节点模块并且:
npm cache clean --forcenpm installnpm install --save-dev @angular/cli@latest但这没有帮助
我刚开始用角与工作角CLI和我见过的,根据该文件,我需要安装$ npm install -g @angular/cli使用-g(全局)标志.
但是我想在本地安装Angular-CLI和其余的node_modules包.这样,当我从git下载我的项目时,我可以简单地运行$ npm install(用于在我的package.json中安装所有依赖项).
我试图通过运行来创建一个新的项目$ npm init,然后运行$ npm i @angular/cli -D(-D是一样的--save-dev).但是当我运行$ ng new project-name一个新的子目录时,创建了一个单独的node_modules目录.
我想在Angular中注销时关闭所有对话框(mat-dialog,bootstrap modals和sweet alert).这是在AngularJS(版本1.5)中完成的方式:
function logout() {
//hide $mdDialog modal
angular.element('.md-dialog-container').hide();
//hide any open $mdDialog modals & backdrop
angular.element('.modal-dialog').hide();
angular.element('md-backdrop').remove();
//hide any open bootstrap modals & backdrop
angular.element('.inmodal').hide();
angular.element('.fade').remove();
//hide any sweet alert modals & backdrop
angular.element('.sweet-alert').hide();
angular.element('.sweet-overlay').remove();
}
Run Code Online (Sandbox Code Playgroud)
我怎么能在Angular中做到这一点?使用$('.mat-dialog-container')或$('.inmodal')不给我一个选择hide()或做close()
我尝试过这样做,但我无法获得元素参考:
import { ElementRef, Injectable, ViewChild } from '@angular/core';
import { MatDialog, MatDialogContainer, MatDialogRef } from '@angular/material';
export class MyClass
{
@ViewChild('.mat-dialog-container') _matDialog: ElementRef;
@ViewChild('.mat-dialog-container') _matDialogRef:MatDialogRef<MatDialog>;
constructor() { }
function logout()
{
//access the …Run Code Online (Sandbox Code Playgroud) angular ×6
javascript ×4
angular-cli ×2
css ×2
refresh ×2
angular6 ×1
auto-indent ×1
autolayout ×1
components ×1
duplicates ×1
ellipsis ×1
html ×1
integer ×1
ng-bootstrap ×1
node-modules ×1
notepad++ ×1
npm-install ×1
numbers ×1
plugins ×1
production ×1
routes ×1
sweetalert2 ×1
tooltip ×1
webpack ×1