小编Але*_*тић的帖子

禁用不工作

  1. 不工作:
    • [disabled] = true ,
    • [disabled] = "isDisabled" ----- ts>(isDisabled = true)
    • 基本的html disabler也没有wokring ---- html> disable
    • [attr.disabled] = true ,
    • [attr.disabled] = "isDisabled"----- ts>(isDisabled=true)

我正在尝试为预览和更新制作相同的表单(预览应该禁用输入),但我在html中的输入无法绑定到typescript boolean.在html中,我有一个带有person.name,person.surname ....按钮(预览),按钮(更新)的表,它们都触发onSelect函数并发送person + true/false.

<input [(ngModel)]="osoba.ime" [attr.disabled]="isDisabled" name = "ime" type="text" id="ime">
Run Code Online (Sandbox Code Playgroud)

和打字稿功能和属性

isDisabled = true;

onSelect(o: Osoba, isView) {
    this.isDisabled = isView;
    console.log(document.getElementById('ime'));
    console.log(this.isDisabled);
    this.selectedOsoba = o;
}
Run Code Online (Sandbox Code Playgroud)

this.isDisabled的日志有效

但该元素的日志甚至没有禁用属性

<input _ngcontent-c5="" id="ime" name="ime" type="text" ng-reflect-name="ime" ng-reflect-model="Dusan     " class="ng-untouched ng-pristine ng-valid">
Run Code Online (Sandbox Code Playgroud)

这是整个HTML代码

<form *ngIf="osoba">
  <div class="input">
    <label>Ime Osobe</label>
    <input [disabled]= …
Run Code Online (Sandbox Code Playgroud)

data-binding typescript angular

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

没有简单组件的提供者

直到 5 分钟前它才工作没有意义......这是组件

import { Component, OnInit } from '@angular/core';
import {Osobaa} from '../osobaa';
import { Osoba } from '../osoba';
import {OsobaService} from '../osoba.service';

@Component({
  selector: 'app-form-add',
  templateUrl: './form-add.component.html',
  styleUrls: ['./form-add.component.css']
})
export class FormAddComponent implements OnInit {
  osoba : Osobaa;
  constructor() { }

  ngOnInit() { }

}
Run Code Online (Sandbox Code Playgroud)

这是主要的 app.module.ts

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import {FormsModule} from "@angular/forms";

import { AppComponent } from "./app.component";
import { HeaderComponent } from "./header/header.component";
import { …
Run Code Online (Sandbox Code Playgroud)

angular-providers angular

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

如何使用 get http 请求发送参数(id)?

我开始打字,http.get 只接受 url,所以我不知道如何发送一个人的 id 以从我的 api 中获取该人,该人从 Sql 数据库中获取。

public getByID(n :number) : Promise<any>{

    return this.http.get(this.url).toPromise();
  }
Run Code Online (Sandbox Code Playgroud)

也许将它附加到一个网址?

get http angular

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

如何在while while循环中跳过?

问题是我不能写一个do while没有while部分的循环......我可以以某种方式跳过它或者......?

 // 9. Keep adding numbers untill you add number 7 twice in a row .
 int a;
 int b;

 do
 {
      Console.WriteLine("add number:");
      a = int.Parse(Console.ReadLine());
      Console.WriteLine("add number:");
      b = int.Parse(Console.ReadLine());
      if (a == 7 && b == 7)
      {
          break;
          Console.WriteLine("end");

      }
}
Run Code Online (Sandbox Code Playgroud)

c#

-3
推荐指数
1
解决办法
766
查看次数

标签 统计

angular ×3

angular-providers ×1

c# ×1

data-binding ×1

get ×1

http ×1

typescript ×1