javascript - Ember: Build Error Unexpected token -
i following tutorial try codes below
controller index.js
import ember 'ember'; export default ember.controller.extend({ emailaddress: '', isvalid: ember.computed.match('emailaddress', /^.+@.+\..+$/), isdisabled: ember.computed.not('isvalid') actions: { saveinvitation() { alert(`saving of following email address in progress: ${this.get('emailaddress')}`); this.set('responsemessage', `thank you! we've saved email address: ${this.get('emailaddress')}`); this.set('emailaddress', ''); } } });
index.hbs
<div class="jumbotron text-center"> <h1>coming soon</h1> <br/><br/> <p>don't miss our launch date, request invitation now.</p> <div class="form-horizontal form-group form-group-lg row"> <div class="col-xs-10 col-xs-offset-1 col-sm-6 col-sm-offset-1 col-md-5 col-md-offset-2"> {{input type="email" value=emailaddress class="form-control" placeholder="please type e-mail address." autofocus="autofocus"}} </div> <div class="col-xs-10 col-xs-offset-1 col-sm-offset-0 col-sm-4 col-md-3"> <button class="btn btn-primary btn-lg btn-block" disabled={{isdisabled}} {{action 'saveinvitation'}}>request invitation</button> </div> </div> {{#if responsemessage}} <div class="alert alert-success">{{responsemessage}}</div> {{/if}} <br/><br/> </div>
what expected if click on button, saveinvitation action called , shows alert box, sets responsemessage property, , deletes content of emailaddress.
however, got error this
build error library-app/controllers/index.js (in /users/cy/desktop/ember/library-app/tmp/babel-input_base_path-omvwkqcg.tmp/0) broccoli plugin: [babel] failed with: syntaxerror: library-app/controllers/index.js: unexpected token (9:1) isdisabled: ember.computed.not('isvalid') actions: { saveinvitation() { alert(`saving of following email address in progress: ${this.get('emailaddress')}`); this.set('responsemessage', `thank you! we've saved email address: ${this.get('emailaddress')}`);
Comments
Post a Comment