Hello All, 

I'm trying to get the Todo example in the angular 2.0 code working.
I've tried the changes below. However it seems that App is not defined on 
appModule. As far as I can tell when debugging the execute function on the 
compiled app.js is not executed.
Could anyone help me out to get the sample working ?

Thanks,

Marwijn.

--------------

index.html:

<!doctype html>
<html>
<body>
    <input type="test">
    <ul></ul>

    <% if(type === 'dart') { %>
    <script src="main.dart" type="application/dart"></script>
    <% } else { %>
        
        <script src="../../../traceur-runtime.js" 
type="text/javascript"></script>
<script src="../../../es6-module-loader.src.js" 
type="text/javascript"></script> 
<script src="../../../extension-register.js" 
type="text/javascript"></script>
<script type="text/javascript">
register(System);
</script>
 <script src="../../../rtts_assert/lib/rtts_assert.js" 
type="text/javascript"></script>
        <script src="app.js" type="text/javascript"></script>
        <script src="../../../facade/lib/dom.js" 
type="text/javascript"></script>
        <script src="main.js" type="text/javascript"></script>
    <% } %>
</body>
</html>

--------------------

main.es5:

System.baseURL = '/';

System.import("examples/lib/todo/app")
.then(function(appModule){
console.log("import done");
app = new appModule.App(); // App is undefined on appModule;
console.log("will not get here");
});

------------------

app.js

import {DOM} from 'facade/dom';

export class App {
  constructor() {
    this.input = null;
    this.list = null;
  }
  run() {
    this.input = DOM.query('input');
    this.list = DOM.query('ul');
    DOM.on(this.input, 'change', (evt) => this.add(evt));
  }
  add(evt) {
    var html = DOM.getInnerHTML(this.list);
    html += '<li>'+this.input.value+'</li>';
    DOM.setInnerHTML(this.list, html);
    this.input.value = '';
  }
}

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to