Javascript 摄氏度到华氏度(单位:js)

Javascript 摄氏度到华氏度(单位:js),javascript,html,angularjs,typescript,Javascript,Html,Angularjs,Typescript,我是编程新手,我想创建一个像照片中描述的那样的程序。 在“converter.component.html”文件中,我编写了以下代码 <html> <head></head> <body> <fieldset> Celsius : <input type ="text"/ > Fahrenheit :{{celcius}} <span> </span> </fieldset> <

我是编程新手,我想创建一个像照片中描述的那样的程序。 在“converter.component.html”文件中,我编写了以下代码

<html>
<head></head>
<body>
<fieldset>
  Celsius : <input type ="text"/ > Fahrenheit :{{celcius}} <span> </span>
</fieldset>
</body>
</html>
function celsiusToFahrenheit($scope) {
  $scope.$watch('celsius', function(value) {
    $scope.fahrenheit = value * 9.0 / 5.0 + 32;
  });
}

但它不适用于我

converter.component.html

<!-- Add other tags by yourself))-->
<input [(ngModel)]="value" (ngModelChange)="convert()">
result {{result}}

请问,你能告诉我怎么做吗?当你说这对我不起作用时,你的意思是什么?发生了什么?假设会发生什么。控制台中有错误吗?@Nicolas我的页面没有从摄氏度转换为华氏度,但我写了一个公式,正确地说我的页面[应该做X]不做X与它不工作是一样的。应该发生什么,实际发生了什么,为什么你认为它不起作用?是否显示错误的计算结果?什么都没有?抛出一些错误?@JefreySobreiraSantos我无法创建需求中给出的这种程序
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit  {
    constructor() { }
  public value: number;
  public result: number;
  ngOnInit() {
  }
  convert(){
    this.result = this.value * 9.0 / 5.0 + 32;
  }
}