[英]When I am using angular-cli, how do I implement the controller?
What I want to do: simple event, when user clicks a button, "hello world" is output to console or screen 我想做的:简单事件,当用户单击按钮时,“ hello world”将输出到控制台或屏幕
What I am having trouble with: I understand what a controller does, but what I don't understand is how to create a controller, link that file(if its a file) to my view. 我遇到的问题:我了解控制器的功能,但是我不了解的是如何创建控制器,将该文件(如果是文件)链接到我的视图。 Do I just link the script src of the file?
我是否只链接文件的脚本src? do i import it to component.ts?..this is where i am confused.
我要导入到component.ts吗?..这是我很困惑的地方。
In angular component.ts file work as a controller. 在angular component.ts文件中,它充当控制器。 The component is associated with view.
该组件与视图关联。 If you are mapping from AngularJS to angular the component.ts is nothing but the controller of your view.
如果您是从AngularJS映射到angular,则component.ts只是视图的控制器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.