小编apo*_*tsi的帖子

PRIME ng确认服务的角度单元测试

首先,我是角单元测试的新手。我想对以下方法进行单元测试,该方法将从我的数据中删除一条记录。方法是:

//Confirm Button for deletion


 confirm(name: string, id: any) {
      this.confirmationService.confirm({
          message: 'Are you sure you want to remove ' + name + ' from your list of Supporting Staff?',
          accept: () => {
             const index: number = this.data.indexOf(id);
              if (index !== -1) {
                this.data.splice(index,1);
                this.totalResults = this.data.length;
                this.updateVisibility();                
                this.alertMessage = { severity: 'success', summary: 'SUCCESSFUL REMOVAL', detail: 'You have successfully removed '+name+' from your Supporting Staff List.' };
                this.alertMessagesSrv.pushAlert(this.alertMessage);
               }   
          },
      reject: () => {       
      }
      });

  }
Run Code Online (Sandbox Code Playgroud)

如您所见,我正在从PRIME …

service unit-testing primeng angular

4
推荐指数
2
解决办法
1181
查看次数

Angular 5 无效日期 IE 11

我正在使用 Angular 5,并尝试将字符串转换为日期。在 Chrome 中工作正常,但在 Internet Explorer 11 中,我收到无效日期的错误。我尝试了多种方法,但都没有成功。我也遵循此处提供解决方案 解决方案提供我作为输入的字符串是 '2018-04-23 15:21:15 +0300' (value),我使用以下代码:

var a = new Date(value);
Run Code Online (Sandbox Code Playgroud)

我还尝试了以下方法:

var a = new Date (new Date(value));
Run Code Online (Sandbox Code Playgroud)

internet-explorer date invalidation angular angular5

2
推荐指数
1
解决办法
6864
查看次数

空列表中的非详尽模式错误

我正在声明一种新的内存类型,然后使用一个函数来更新它.当我向列表中添加值时,程序编译并正常工作,但如果我的列表为空,则会出现错误"函数中的非详尽模式update".这是我的代码,如果你能帮助我:

type Name = [Char] 
type Memory = [(Name,Integer)] 

update :: Name ->Integer -> Memory -> Memory
update n x (h:t)
    |(fst h==n) =(n,x):t
    |((h:t) == []) = (n,x):[]
    |(fst t==x) = h:(n,t)
    |(t==[]) =  h:(n,x):[]
    |otherwise = h:update n x t 
Run Code Online (Sandbox Code Playgroud)

haskell

0
推荐指数
1
解决办法
224
查看次数