我有使用set方法的组件:
@Input('message')
set messageFromSocket(String message) {check(details)}
该消息可能类似于某些实体已更新',并且多次从主机组件发出:
@View(
template: "<message-view [message]='message' [details]='details'></message-view>")
class Example implements OnInit {
@override
Future ngOnInit() async {
...
socket.stream.listen((String data) async {
details = (JSON.decode(data) as Map);
message = (details['Message'] as String);
});
}
每次主机中的消息更新时,如何运行messageFromSocket?
要点:https://gist.github.com/Rasarts/b67d841c184a8256671d44947ffdddd5