I am developing a simple test app in Angular 2 and having problems passing a property to a nested component. See source code below. The template from the nested component renders, but the property passed to the nested component does not render. The rendered output is:
This is a .
Whereas, I would expect the following:
This is a test.
No errors are generated in the browser console. I have also tried utilizing properties: 'inputtext' in the nested component since the name remains the same in the view, but this generates a Can't bind to ... error in the console. As for the Angular2 version, I'm using the latest (Alpha-34).
Any suggestions?
index.html
<html>
<head>
<title>Angular 2 Test App</title>
<script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script>
<script src="https://jspm.io/[email protected]"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.34/angular2.dev.js"></script>
</head>
<body>
<h1>Welcome to my Angular 2 Test App</h1>
<app></app>
<script>System.import('app');</script>
</body>
</html>
app.ts
import {Component, View, bootstrap} from 'angular2/angular2';
//nested component
@Component({
selector: 'input-component',
properties: ['inputtext:inputtext']
})
@View({ template: '<h1>This is a {{inputtext}}.</h1>'})
class inputComponent{}
// root app
@Component({ selector: 'app' })
@View({
directives: [inputComponent],
template: '<input-component [inputtext]="test"></input-component>'
})
class rootApp{}
bootstrap(rootApp);