我有以下功能:
def removeLast(list: List[Int]): List[Int] = list match {
case List() => List()
case List(x) => List()
case x :: xs => x :: removeLast(xs)
}
Run Code Online (Sandbox Code Playgroud)
当我定义它并从sbt控制台使用它时一切正常.但是当我在Intellij IDEA中创建工作表并尝试运行它时,会出现以下异常:
java.lang.NoSuchMethodError:scala.collection.immutable.$ colon $ colon.hd $ 1()Ljava/lang/Object; at week5.A $ A26 $ A $ A26.removeLast(lists.sc8362409100671270508.tmp:30)at#worksheet#.#worksheet#(lists.sc8362409100671270508.tmp:33)
另外,当我将最后一行更改为:
case x :: xs => 1 :: removeLast(xs)}
Run Code Online (Sandbox Code Playgroud)
然后它工作.
问题可能是什么?
我尝试强制 jHipster 生成的 Angular 5 项目中的日期选择器使用波兰语语言环境,一周和几个月。据我了解有关文档:
https://ng-bootstrap.github.io/#/components/datepicker/examples#i18n
它应该使用默认设置,即:
共享-common.module.ts
...
import { registerLocaleData } from '@angular/common';
import locale from '@angular/common/locales/pl';
...
providers: [
...
{
provide: LOCALE_ID,
useValue: 'pl'
},
],
...
export class TestSharedCommonModule {
constructor() {
registerLocaleData(locale);
}
}
Run Code Online (Sandbox Code Playgroud)
用法
<input id="field_testDate" type="text" class="form-control" name="testDate"
ngbDatepicker #testDateDp="ngbDatepicker" [(ngModel)]="tester.testDate"
required/>
Run Code Online (Sandbox Code Playgroud)
不幸的是它不起作用,我也尝试了不同的方法,例如:
https://angular.io/api/core/LOCALE_ID
或者
https://github.com/NativeScript/nativescript-angular/issues/1147 - 我在这里复制了语言环境文件
你有什么想法可能是错的吗?
更新
我最终是这样解决的:
日期选择器-i18n.ts
import { Inject, Injectable, LOCALE_ID } from '@angular/core';
import { NgbDatepickerI18n } from '@ng-bootstrap/ng-bootstrap';
const I18N_VALUES = {
en: …Run Code Online (Sandbox Code Playgroud) angular ×1
angular5 ×1
datepicker ×1
intellij-13 ×1
localization ×1
ng-bootstrap ×1
sbt ×1
scala ×1