Note that there are some explanatory texts on larger screens.

plurals
  1. POEquivalent of JavaScript in TypeScript
    primarykey
    data
    text
    <p>Currently I am working on <strong><em>Durandal 2.0 project</em></strong>. Initially I was using this JavaScript code to execute my <strong><em>shell.js(ViewModel)</em></strong>, which is working perfectly fine.</p> <p>Initial JavaScript Code (working one)</p> <pre><code> define(['plugins/router', 'durandal/app'], function (router, app) { return { router: router, search: function() { app.showMessage('Search not yet implemented...'); }, activate: function () { router.map([ { route: '', title:'Welcome', moduleId: 'viewmodels/welcome', nav: true }, { route: 'flickr', moduleId: 'viewmodels/hello', nav: true } ]).buildNavigationModel(); return router.activate(); } }; }); </code></pre> <hr> <p>Now I am trying to use typescript. So I wrote this code(below one), which is not working Typescript Code:</p> <pre><code> /// &lt;reference path="../../Scripts/typescripts/jquery/jquery.d.ts" /&gt; /// &lt;reference path="../../Scripts/typescripts/knockout/knockout.d.ts" /&gt; /// &lt;reference path="../../Scripts/typescripts/durandal/durandal.d.ts" /&gt; import _config = require('config'); import _router = require('plugins/router'); import _app = require('durandal/app'); class shell { //config = new _config.Config(); app = _app; router = _router; activate() { this.router.map([ { route: '', title: 'Welcome', moduleId: 'viewmodels/welcome', nav: true }, { route: 'flickr', moduleId: 'viewmodels/hello', nav: true } ]).buildNavigationModel(); return this.router.activate(); } } </code></pre> <hr> <p>Output of typescript: JavaScript code generated by TypeScript(Not Working)</p> <pre><code> /// &lt;reference path="../../Scripts/typescripts/jquery/jquery.d.ts" /&gt; /// &lt;reference path="../../Scripts/typescripts/knockout/knockout.d.ts" /&gt; /// &lt;reference path="../../Scripts/typescripts/durandal/durandal.d.ts" /&gt; define(["require", "exports", 'plugins/router', 'durandal/app'], function(require, exports, ___router__, ___app__) { var _router = ___router__; var _app = ___app__; var shell = (function () { function shell() { //config = new _config.Config(); this.app = _app; this.router = _router; } shell.prototype.activate = function () { this.router.map([ { route: '', title: 'Welcome', moduleId: 'viewmodels/welcome', nav: true }, { route: 'flickr', moduleId: 'viewmodels/hello', nav: true } ]).buildNavigationModel(); return this.router.activate(); }; return shell; })(); }); </code></pre> <hr> <p>Can anyone suggest me what is the issue?? the error I am getting is this,</p> <blockquote> <p>Unable to parse bindings.</p> <p>Bindings value: attr: { href: router.navigationModel()[0].hash }</p> <p>Message: router is not defined;</p> <p>View: views/shell;</p> <p>ModuleId: viewmodels/shell</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload