我有一个#contentdiv和一个按钮组件。
单击按钮时,我想滚动到#content div的顶部。
HTML:
<div id="content">
Loren ipsum
</div>
<div (click)="toTop($event)">top</div>
Run Code Online (Sandbox Code Playgroud)
topscroll.component.ts:
<div id="content">
Loren ipsum
</div>
<div (click)="toTop($event)">top</div>
Run Code Online (Sandbox Code Playgroud) 我想从Highcharts切换到ECharts(最好是3个),但是我当前的图形有多个系列(在我的情况下为“线”),每个系列都有各自的yaxis,看来ECharts不支持此功能。
这些指标根本不相关,因此它们都需要自己的yaxis。我将它们合并为1张图表,以便可以将它们彼此进行比较(500次访问,30000欧元,3%的转化率等)。在同一个Y轴上绘制500次访问和3%的转化率是没有意义的。
有没有办法给每条线自己的坐标轴?它不必是可见的(因为只有ECharts可以有两个,在画布的左/右,没关系),但是数据需要绘制到单个轴上。
从我的模板中,我ng-click="$widget.addItem()"用来触发$uibModal.
一切正常,打开,关闭等。
问题是,我无法让$modal.close($value)回调值起作用。该函数本身工作正常,模态关闭,并调用 promise 成功函数。问题是,它总是返回undefined.
组件控制器
app.component('list', {
templateUrl: 'widgets/list.html',
controllerAs: '$widget',
controller: function($uibModal) {
// Add item through modal
this.addItem = function() {
// Init and open $uibModal
var modalInstance = $uibModal.open({
component : 'modalAddItem',
size : 'md'
});
// $uibModal promise
modalInstance.result.then(function(params) {
console.log(params)
// ---> undefined
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
模态模板
<div class="modal-add-item">
<div class="modal-body" id="modal-body">
// Some template stuff here
</div>
<div class="modal-footer">
<button class="btn btn-sm btn-default" ng-click="$modal.ok()">Ok</button> …Run Code Online (Sandbox Code Playgroud) 使用Xcode 11的Beta 5,我得到警告:
“'buttonStyle'已过时:直接使用具体的'PrimitiveButtonStyle'类型。”
我尝试了几件事,但没有找到解决方法。
Button(action: { }) {
Text("Hello")
}.buttonStyle(.plain)
Run Code Online (Sandbox Code Playgroud) 我正在创建一个网站(在AngularJS中),该网站通过OAuth.io的javascript SDK 使用Google AnalyticsAPI .
一切都很简单,但是他们的文档确实缺乏; 它很短,只有很少的代码示例.
目前,每次刷新页面时,我都需要再次验证(通过弹出窗口),并且看到有一种方法可以使用他们的SDK启用缓存(注意:我知道可以使用cookie或浏览器存储来完成,但我想使用他们的SDK来做到这一点.)
它在这里解释:https://oauth.io/docs/api-reference/client/javascript#detailed-description-oauth-object-available-methods-popup
您可以使用'options,enable cache',但我真的不知道如何以及在何处添加此参数来执行此操作.
我弹出的代码:
$scope.connect.analytics = function() {
OAuth.popup('google_analytics')
.done(function(result) {
console.log(result);
$scope.connect.status = true;
})
.fail(function (err) {
console.log(err)
});
};
Run Code Online (Sandbox Code Playgroud) 因为我有时需要if语句
if (variable == 'one' || variable == 'two' || variable == 'three') {
// code
}
Run Code Online (Sandbox Code Playgroud)
我想知道你是否可以写这个更短,如:
if (variable == ('one' || 'two' || 'three')) {
// code
}
Run Code Online (Sandbox Code Playgroud) 我需要帮助来改善图表线上显示的点数。使用当前代码,对于 100000 个点,仅在图形中绘制了 20 个点。
var elements = new Array(100000);
for (i = 0; i < elements.length; i++) {
elements[i] = i;
}
var myChart = echarts.init(document.getElementById('main'));
var option = {
title: {
text: 'ECharts entry example'
},
tooltip: {},
legend: {
data:['Sales']
},
xAxis: {
data: elements
},
yAxis: {},
series: [{
name: 'Sales',
type: 'line',
data: elements
}]
};
myChart.setOption(option);
Run Code Online (Sandbox Code Playgroud)
Angular在其文档中提供了一个默认.htaccess文件:
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
Run Code Online (Sandbox Code Playgroud)
然而,这并不强制 https://。
无论我尝试(使用的答案或片段约HTTPS类似的问题://强迫),它总是打破了路由,并且在任何结果404或Apache is functioning normally通知。
如何更新此代码段以强制使用 https://,同时保持路由完整?
我从 MySQL 数据库获取用户列表以<mat-table>使用dataSource属性显示它:
以下是 typescript 方法getUnitData(),我将 dataSource 值设置为从 PHP 脚本返回的 JSON 数组:
export class RegistrationComponent implements OnInit {
dataSource: MatTableDataSource<units>;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
constructor(private auth: AuthApiService) { }
ngOnInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
applyFilter(filterValue: string){
this.dataSource.filter = filterValue.trim().toLowerCase();
if(this.dataSource.paginator)
{
this.dataSource.paginator.firstPage();
}
}
getUnitData(){
this.auth.getUnitDataService().subscribe(
(data)=>
{
this.dataSource = new MatTableDataSource(data);
},
(error)=>
{
}
)
}
}
Run Code Online (Sandbox Code Playgroud)
这是来自的主要方法AuthApiService:
getUnitDataService(){
if(this.checkIsLogin){
this.headerOptions.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
return …Run Code Online (Sandbox Code Playgroud) javascript ×5
angular ×3
angularjs ×2
echarts ×2
.htaccess ×1
angular6 ×1
charts ×1
datasource ×1
oauth-2.0 ×1
operators ×1
swiftui ×1
typescript ×1