由于我听说Angular的路由器支持嵌套的<router-outlet>标签,我正在尝试使用其中的两个.我正在使用最新的Angular-CLI,从ui-router转换为Angular的路由器.我无法获得第二个路由器来填充内容.
(父路由工作正常)app-routing.module.ts
...
const routes: Routes = [
{ path: '', pathMatch: 'full', component: LoginComponent },
{ path: 'login', pathMatch: 'full', component: LoginComponent },
{ path: 'dashboard',
pathMatch: 'full',
component: DashboardComponent // this holds the second router-outlet
},
{ path: '**', component: LoginComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [ RouterModule ]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)
app.component.ts - 这只是持有路由器插座,并在顶层工作正常...
<router-outlet></router-outlet>
Run Code Online (Sandbox Code Playgroud)
尝试1 dashboard-routing.module.ts
export const dashboardRoutes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'home' …
Run Code Online (Sandbox Code Playgroud) 我试图允许数据对象标签的空格中断。我查看了 Chartjs 文档勾选配置上的配置选项,以允许换行或添加 CSS 类,我可以使用断词规则来处理此问题。
数据结构对象:
{
labels: ["Arts Languages and Communication", "Science, Techology and Health", "Business", "Society and Education"],
datasets: [{label: "Fall 2014", data: [0,0,0,0]}...]
}
Run Code Online (Sandbox Code Playgroud)
选项对象:
{
scales: {
xAxes: [{ ticks: { /* no available options from docs */ } }]
}
}
Run Code Online (Sandbox Code Playgroud)
期望的结果:
单词会因空格而中断:
Arts Language
and Communication
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用speechSynthesis http://blog.teamtreehouse.com/getting-started-speech-synthesis-api
首先,我使用界面扩展了窗口:
window.interface.ts
export interface IWindow extends Window {
webkitSpeechRecognition: any;
speechSynthesis: any;
}
Run Code Online (Sandbox Code Playgroud)
接下来我做了一个窗口服务:
window.service.ts
import { Injectable } from '@angular/core';
import { IWindow } from '../interfaces/window-interface';
function _window() : IWindow {
return window;
}
@Injectable()
export class WindowService {
get nativeWindow() : any {
return _window();
}
}
Run Code Online (Sandbox Code Playgroud)
现在在组件中,我正在尝试实现它......没有成功..
app.component
import { Component, OnInit, ViewChild } from '@angular/core';
import { WindowService } from '../../providers/window.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['.app.component.scss']
})
export class AppComponent implements OnInit …
Run Code Online (Sandbox Code Playgroud) 我正在使用 React-Select 2.4.2 版。在 iOS Chrome、Firefox、Safari 上测试。
我已经阅读了文档,但找不到正确的道具来传递这种情况。
我希望菜单显示在移动设备上,而不是显示在键盘或任何 iOS 原生页脚上。当然,切换 isDisabled 不起作用,因为它禁用了整个输入和选择菜单。
将“可搜索”道具翻转为 false 实际上会禁用键盘,但在 Safari 和 Firefox 上显示“完成”的页脚,在 Chrome 上显示“X”。
理想情况下,我可以只禁用输入,但仍然允许触摸选择选项。
示例代码:
<Select
value={selectedOption}
options={selectOptions}
onChange={handleOptionSelect}
placeholder={placeholderText}
isDisabled={false} {/* bool toggles affect entire plugin */}
blurInputOnSelect={true} {/* don't want any input/keyboard on mobile */}
readonly={true} {/* tried, didn't work */}
searchable={false} {/* disables keyboard, but still shows iOS footer with "Done" button in Safari and Firefox, and an "X" in Chrome, and zooms in when touching …
Run Code Online (Sandbox Code Playgroud) 我想在Angular2 Material中的fab按钮内放置一个图像.如果您在Google或Gmail上登录,则会看起来如此.
Angular2 Material docs还没有任何内容.
例如,请看这张图片:http://www.mattpaulson.com/wp-content/uploads/2014/03/gmail-zero.png
我一直在玩的代码(不起作用)是:
<button md-fab
type="button">
<img md-fab-image [src]="userInfo.photoUrl">
<div class="md-ripple-container"></div>
</button>
<button md-fab
type="button">
<img md-fab-image [src]="userInfo.photoUrl">
</button>
<button md-fab md-fab-image
type="button">
<img md-fab-image [src]="userInfo.photoUrl">
</button>
<button md-icon-button
type="button">
<img [src]="userInfo.photoUrl">
</button>
<button md-icon-button
md-fab-image
type="button">
<img [src]="userInfo.photoUrl">
</button>
<button md-icon-button md-fab-image
type="button">
<img md-fab-image [src]="userInfo.photoUrl">
</button>
<button md-icon-button md-fab-image
type="button">
<img md-fab-image [src]="userInfo.photoUrl">
</button>
Run Code Online (Sandbox Code Playgroud)
<button md-fab md-button
style="overflow:hidden;top:1rem;"
type="button">
<img [src]="userInfo.photoUrl" style="max-width:100%">
</button>
Run Code Online (Sandbox Code Playgroud) 我需要使用IE11在SVG中将文本元素完美居中。
// SVG代码:
<svg xmlns="http://www.w3.org/2000/svg" width=100% height="100%" viewBox="0 0 130 130">
<circle fill="dodgerblue" cx="50%" cy="50%" r="65"></circle>
<text text-anchor="middle"
alignment-baseline="central"
font-size="75"
font-family="Arial"
x="50%" y="50%">1</text>
</svg>
Run Code Online (Sandbox Code Playgroud)
我正在尝试定义应从 fp 导入的某些 lodash 方法的列表。此外,我试图禁止从 lodash 的顶层导入。应该禁止从 lodash 进行解构导入。
这是目标:
import _ from 'lodash'; // should show message "Import [module] from lodash/[module] instead"
import { isEqual } from 'lodash'; // should show message "Import [module] from lodash/[module] instead"
import isEmpty from 'lodash/isEqual'; // should pass
import set from 'lodash/set'; // should show message "Import [module] from lodash/fp/[module] instead"
Run Code Online (Sandbox Code Playgroud)
eslintrc.json
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["lodash/set"],
"message": "Import [module] from lodash/fp/[module] instead"
},
{
"group": ["lodash", "!lodash/*"],
"message": …
Run Code Online (Sandbox Code Playgroud) angular ×3
address-bar ×1
chart.js ×1
eslint ×1
interface ×1
javascript ×1
lodash ×1
macos ×1
react-select ×1
reactjs ×1
router ×1
svg ×1
window ×1