Typical component:
@Component (
selector: 'mycomp',
template: '<div>mycomp</div>',
)
class MyComp implements OnInit {
String testobj;
void mymeth() {
context.callMethod('alert', [testobj]);
}
@override
ngOnInit() {
testobj = '123';
context.callMethod('alert', ['initialized']);
}}
placed in app root component like that:
import 'mycomp_component.dart';
import 'package:angular/angular.dart';
@Component (
selector: 'testcomp',
template: '''
<button (click)="testModeler()">load</button>
<mycomp></mycomp>''',
providers: const[MyComp],
directives: const[MyComp],
)
class TestComponent {
MyComp myComp;
TestComponent(this.myComp);
void testModeler() {
myComp.mymeth();
}}
testobj initializes on page load, but when I click a "load" button testobj is null! Why it happens and how to make it working properly?
Also: how to diagnose problems like that in dart, is there a possibility to put a breakpoint on class or field? I don't find a way in dartium/