A silly mistake was not allowing me to retrieve the value of options. The working code is as follows. export class TranslationFilesLoader { public static $inject = ['$http', '$q' ]; constructor( $http: ng.IHttpService , $q: ng.IQService) { return function (options) { var deferred = $q.defer(); var currentLocale = options.key; var...
javascript,angularjs,typescript,tsd
Running tsc App.ts won't work because a file is being specified. Follow the instructions from the documentation: Using tsconfig.json By invoking tsc with no input files, in which case the compiler searches for the tsconfig.json file starting in the current directory and continuing up the parent directory chain. By invoking...
asserts object conforming to my interface You have to do it manually: expect(typeof object.name).to.eql("string"); // so on Update : Writing code to do the deep assertion for you Since the type information TypeScript sees is removed in the generated JS you don't have access to the type information in...
angularjs,typescript,typescript1.5
This is according to spec. Here is your example simplified: interface A{ } interface B { createdId: string; } var foo:ng.IPromise<A>; var bar:ng.IPromise<B>; bar = foo; // No error This assignment is allowed if A is a subtype of B or B is a subtype of A. If this is...
annotations,typescript,decorator
The return value of this decorator is ignored. This is irrelevant to your situation. The return value of parameter decorators is ignored because they don't need to be able to replace anything (unlike method and class decorators which can replace the descriptor). My problem is that when I try...
node.js,namespaces,socket.io,typescript
For anyone else who has this specific problem, I found the answer. I misunderstood the linked question: I didn't realize the array that was being discussed was located in the Server object in SocketIO, not an outside array. Furthermore, at the time of this post, Typescript's SocketIO .d.ts file doesn't...
javascript,angularjs,typescript,require,amd
Makes more sense for angularjs? Angular1 : --module amd Angular2 : --module system as that is what the angularjs team uses internally. Is better for large scale angular apps? Yes. --out and reference comments are a bad idea. More : https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md Would be better at minification+obfuscation of large code...
I have to include /// <reference path="lib/node.d.ts" /> in every file No you don't. Just use a tsconfig.json file : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md ...
javascript,angularjs,typescript,angular-directive
Though it is not quite the same question, this answer included an example of what I'm attempting to do: How can I define my controller using TypeScript? I followed the example in the Plnkr it referenced and found success: http://plnkr.co/edit/3XORgParE2v9d0OVg515?p=preview My final TypeScript directive looks like: module App { 'use...
The way Reflect.ts is coded (as a non-exported internal module) means you cannot import members from it directly. You'll have to explicitly use the .d.ts file and import the library purely for its side-effects: /// <reference path="../node_modules/reflect-metadata/reflect-metadata.d.ts" /> import '../node_modules/reflect-metadata/Reflect'; ...
angularjs,typescript,typescript1.4,typescript1.5
I solved this by using cust in custom.$scope.cust_File as described by @hugues Stefanski. Thanx a lot....
You can't do that on classes, but you can do it with a regular function: interface I { (name: string): void; } var C: I = function(name: string) { }; C("test"); // ok C(1); // compile error Then if you change your interface you will be notified by a compile...
angularjs,typescript,angular-material
You need to inject helpservice and set it in your constructor argument. static $inject = ['$scope', '$mdSidenav', 'helpService']; constructor(private $scope: any,private $mdSidenav: any, private helpService:any) { } otherwise Typescript does not know what are you referring to as this.helpService, even without TS it will result in an error when you...
Your Javascript (a little bit rewritten): var io = require('socket.io'); var server = io(http); server.on(...); Your Typescript: import io = require('socket.io'); var server: SocketIO.Server = io(); ^^ where is `http`? server.on(...) ...
javascript,angularjs,unit-testing,typescript,jasmine
You need to use $provide to provide a mocked value in a unit test: beforeEach(() => { module('myApp', ($provide) => { $provide.value('$window', myMockedWindowObject) }); }); You also need to call $rootScope.$apply() to move promises forward in unit tests....
Most likely reason: you are using Source Maps. When you use source maps, the browser is able to show the source code that relates to the transpiled JavaScript code. You can switch source maps on and off as it is a compiler setting. tsc --sourceMap app.ts Update I have tested...
angularjs,configuration,typescript,service-provider,typescript1.5
Problem is with your registration of provider. Instead of angular.module('apiService').provider('apiService.baseService', BaseServiceProvider); do: angular.module('apiService').provider('BaseService', BaseServiceProvider); and access in the config phase like you do, BaseServiceProvider (postfix word Provider). When injecting the provider instance anywhere else you could just use BaseService. So basically you don't inject with the class name, instead you...
How can I inject or acquire the plat.Utils module Have the following in your class: protected static _inject: any = { _utils: plat.Utils }; protected _utils: plat.Utils; ...
angularjs,http,typescript,iis-7.5,typescript1.4
It is likely that WebDAV is enabled and is interfering with your request. If you aren't using it, you need to get it out of the way so you can use PUT requests for your Web API. You should be able to do this using your web.config file: <system.webServer> /*...
TypeScript 1.4 has support for Type Unions, the notation is: var arr: Int16Array|Uint16Array; Common methods that both of these have will be available on arr. If you use instanceof or typeof checks on arr in conditional/branched code, it will infer the type of arr in those branches. TypeScript 1.4. also...
Unfortunately I couldn't get either to work. Is there a solution to this Don't use --out https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md. Instead use external modules: https://www.youtube.com/watch?v=KDrWLMUY0R0...
javascript,node.js,typescript,typescript1.4
Use --noLib compiler option to exclude lib.d.ts and then add reference to lib.core.d.ts in your source files. Equivalent for tsconfig.json would be "noLib": true. If you only need Node.js definitions, you can also use the Definitely Typed one....
I'm wondering if there's a workaround for this Yes. Use a tsconfig.json file : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md With that you don't need reference comments....
This is how the precedence of the various operators in ECMAScript 6 works. There's a great explanation at http://typescript.codeplex.com/workitem/2360 that walks through each production in sequence....
angularjs,angularjs-scope,typescript,dotnetnuke-7,typescript1.4
You should get rid of this.$http.put('<%=ResolveUrl("~/API/Search/PutDoSearch")%>', Search) And instead use: this.$http.put("/API/Search/PutDoSearch", Search) ...
declare module "R" { interface R { (name: string): void; setLocale(locale: string): void; } var RModule: R; export = RModule; } ...
The issue is that dataService.getSection('HOME_PAGE') is being inferred to return Promise<void> and therefore data is of type void. Fix in your dataService: getSection(secName: string): Promise<any> Or something stronger if you don't want any. (Some basic docs on annotations : http://basarat.gitbooks.io/typescript/content/docs/types/type-system.html) ...
This behavior changed in 1.4 if you are compiling from Visual Studio. To change to the old behaviour open the csproj/jsproj in for example notepad and add the following to it <PropertyGroup> <TypeScriptNoEmitOnError>false</TypeScriptNoEmitOnError> </PropertyGroup> It had something to do with the incremental build system where you had for example 5...
javascript,backbone.js,typescript
Backbone is undefined. How would I import it? Using a script tag. Or an external module loader like requirejs along with AMD modules (--module amd). More : https://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1...
You can just pass in undefined: export interface INotificationService { error(message: string, title?: string, autoHideAfter? : number); } class X { error(message: string, title?: string, autoHideAfter?: number) { console.log(message, title, autoHideAfter); } } new X().error("hi there", undefined, 1000); Playground link....
javascript,enums,typescript,webstorm,object-literal
The code for keyMirror assigns the property key to the value: for (key in obj) { if (obj.hasOwnProperty(key)) { ret[key] = key; } } Therefore, the type of returnVal and CrudTypes.CREATE should be string. Note that Object.keys(...) returns string[] in TypeScript and that the following code outputs string for all...
javascript,visual-studio,google-chrome,typescript,google-chrome-devtools
It seems that Chrome somehow doesn't like UTF-8 with BOM. And this is exactly an encoding which my instance of Visual Studio did save file in. I have switched the encoding to UTF-8 without BOM and the described problems have disappeared. How to: corresponding StackOverflow question. In two words: 1)...
angularjs,angularjs-scope,typescript,typescript1.4,typescript1.5
I have solved this Question by changing the sequence of my java script references. as :- 1.jquery-latest.js 2.app.module.js" 3.Controller.js" 4.Interface.js" 5.angular.js" 6.angular.min.js" 7.app.routes.js" ...
These days everyone use tsconfig.json, either original or atom-flavored (in Atom editor). When using tsconfig.json, you can omit files list and typescript compiler will compile all *.ts files it will find in any subdirectory, including *.d.ts. Excluding files via exclude is on the way, as well as files globbing. If...
I'd like to include this library in both TypeScript and JavaScript Node projects. What is the general strategy to do this? Compile with the following to get the js output: --module commonjs --outDir ./dist This should make your project consumable by JS projects. To make it consumable by TS...
javascript,sorting,knockout.js,typescript,kogrid
Just try to modify your code like this View : <div data-bind="koGrid: gridOptions"></div> viewModel: vm = function () { var self = this; self.myData = ko.observable([{ hours: '113.02 hours' }, { hours: '13.01 hours' }, { hours: '303.01 hours' }, { hours: '33.01 hours' }]); self.gridOptions = { data: self.myData,...
visual-studio,visual-studio-2013,typescript
I'm not sure whether you use Visual Studio Code or Visual Studio 2013. I assume it's VS Code (if it's not, consider switching. VS Code is really good!). Now I'll quote myself from another answer. You can do this with Build commands: Create a simple tsconfig.json with watch = true...
I was not able to get that working but was able to get it working with gulp-traceur. Here is my gulpfile. var gulp = require('gulp'); var gulpTraceur = require('gulp-traceur'); var through2 = require('through2'); var gutil = require('gulp-util'); var sourcemaps = require('gulp-sourcemaps'); var copy = require('gulp-copy'); gulp.task('compile',function() { return gulp.src("./*.es6.js") .pipe(sourcemaps.init())...
The service should look like the following. Don't forget registering the service in the module: export class MDCurrencyService implements IMDCurrencyService { constructor(private $http: ng.IHttpService, private $q : ng.IQService) { } get(): ng.IPromise<MDCurrency[]> { var deferred = this.$q.defer(); this.$httpService.get('/Master/CurrencyGetAll').then(response => { deferred.resolve(response.data); }).catch( reason => { deferred.reject(reason); }); return deferred.promise; }...
typescript,typescript1.5,jspm,systemjs
from 'customer/ICustomer' For typescript you need to use the complete relative path e.g. ./customer/ICustomer. There is discussion to remove this limitation : https://github.com/Microsoft/TypeScript/issues/2338...
visual-studio-2013,configuration,typescript,publishing
However while publishing my project, it still generates js and js.map file foreach .ts files. You probably have different config for debug and release. Make them the same....
angularjs,rest,typescript,umbraco7
I found another way than @basarat is suggesting, from the comment form @ArghyaC. The problem is that Umbraco's REST controller builds on asp.net's ControllerApi, and defaults to xml. The apostrophes comes from the xml serialize. The solution is simple force json as the return value instead. I don't dare to...
Export the variable you want to modify: module validator { export var regex = /^[A-Za-z]+$/; // <-- export var export var ok = (s: string) => regex.test(s); }; validator.regex = /.*$/; This will make module behave similar to a static class: you have a single point of access to this...
node.js,visual-studio,typescript,jasmine,protractor
Typescript wants a semicolon after You are using an older version of TypeScript. Upgrade to TypeScript 1.4 or later....
google-chrome-extension,requirejs,typescript
The docs for the error message state: Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them. As described in this question, it seems that if you use import in...
c#,namespaces,typescript,keyword
You can read about it in the namespace keyword issue, but the basic idea is to differentiate between internal (namespace) and external (module) modules. To better align with ES6 modules as suggested in #2159, this PR introduces a new namespace keyword as the preferred way to declare what was formerly...
You have to be careful with this semantics. In this code: return this.$http.get('facilities.json').success(function(response) { this.result = response; console.log(this.result); }) this is not referring to your test instance, but instead to whatever context the function is running in. Instead do this: return this.$http.get('facilities.json').success((response) => { this.result = response; console.log(this.result); }) Now...
angularjs,angularjs-directive,typescript
Try this way: class SetFocus implements ng.IDirective { //Directive settings restrict :string = 'EA'; scope : any= {}; //Take timeout argument in the constructor constructor(private $timeout: ng.ITimeoutService) { } link: ng.IDirectiveLinkFn = ($scope: ng.IScope, $element: ng.IAugmentedJQuery, $attrs: ng.IAttributes) => { //refer to the timeout this.$timeout(function() { $element[0].focus(); }, 0); }...
Fix at : interface DataTypeString extends DataTypeStringBase { (length?:number): any; // ADD this } A PR + TEST would be appreciated :) Update Would it be possible somehow to implement this in my own .d.ts file, extending the provided one? FAILED ATTEMPT Untested but probably correct: declare module "sequelize" {...
Just specify $timeout as the factory constructor function argument and pass it through. static factory(): ng.IDirectiveFactory { var directive: ng.IDirectiveFactory = ($timeout:ng.ITimeoutService) => new myDirective($timeout); directive.$inject = ["$timeout"]; return directive; } ...
jquery,requirejs,typescript,visual-studio-cordova
I'm not sure if this is a problem with RequireJS and jQuery or VS2015RC + Cordova. The error is that jquery isn't resolving to the jquery.js file (an HTTP 404 error). Check the HTTP Get request made by the browser. It will be something like http://yourapp/scripts/lib/jquery.js. Make this GET...
There is an export import syntax for legacy modules, and a standard export format for modern ES6 modules: // export the default export of a legacy (`export =`) module export import MessageBase = require('./message-base'); // export the default export of a modern (`export default`) module export { default as MessageBase...
javascript,knockout.js,typescript
This works fine for me as the entire app. I can't tell what I'm doing differently from what you describe, so I'm just including the whole thing. class TodayVM { asOfString: KnockoutObservable<string>; constructor() { this.asOfString = ko.observable(''); this.updateSummary(); } updateSummary = () => { this.asOfString(new Date().toDateString() + " " +...
jquery,enums,typescript,ienumerable,enumeration
TypeScript enums when compiled into plain JS contain both the symbolic name AND the numeric values as properties and that explains why you get FrontEnd, BackEnd, Designer, 0, 1, 2 when you try to enumerate the properties of the object. As best I know, there is no post-compile way to...
The problem is in typings/webaudioapi/waa.d.ts. TypeScript 1.5 includes Web Audio API declarations internally and you get duplicate identifiers. To solve the problem, remove the typings/webaudioapi/waa.d.ts file and remove the reference to it from typings/tsd.d.ts In previous versions of TypeScript compiler this file was not included and errors didn't show up....
javascript,typescript,typescript1.5
It looks like you're using wrong dash character in your tsc --out. TypeScript compiler looks at your command and instead of "invoke tsc with file Test.ts and output to sample.js" sees something along the lines of "invoke tsc with 3 files: --out, sample.js, Test.ts". It then looks for these files...
javascript,knockout.js,typescript
Try to use this approach: // import knockout import ko = require("knockout"); // your viewmodel class class TodayViewModel { todayText = ko.observable<string>(); } // register the component ko.components.register("like-widget", { viewModel: TodayViewModel, template: "<span data-bind='text: todayText'></span>" }); P.S. you will need knockout.TypeScript.DefinitelyTyped...
javascript,angularjs,typescript,q
There are several ways to return a promise... $http returns a promise with each of its ajax calls, $timeout also returns a promise. That being said you want to return a promise based upon something other than a scheduled event ($timeout, $interval) via $q you can do this... // assume...
angularjs,constructor,typescript,undefined,this
Config functions aren't classes and shouldn't be written as such. Angular is invoking them without new and thus this will be undefined (or, God help you, window in non-strict mode). It doesn't really make sense to use a class here as there's no instance to be kept around. If you...
Is this a bug or am I missing something This is by design. According to spec the inferred type from && is the type of the last expression. So the inferred type of the following is string: var x = false && "foo"; This to support a common JavaScript...
You can pass the the command line arguments as a file e.g. tsc @sometFileThatContainsTheArguments.txt. That overcomes any command line limits PS: This is a trick that grunt-ts uses as well btw...
types,typescript,typescript1.4
You will need to do some type checking and casting to handle this scenario: (member: resources.IMember) => { return member.user.id == user.id; if (typeof (member.user) === 'number') { return member.user == user.id; } else { return (<ISimpleUser>member.user).id == user.id; } }).length > 0; Just because you know the possible types...
I'd be glad to have some code examples demonstrates what they meant. The following is allowed : interface A{ } interface B{ foo: number; } interface Something { [index: string]: A; [index: number]: B; } But this is not: interface A{ foo: number; } interface B{ } interface Something...
view,formatting,typescript,rendering,marionette
By checking this link: http://derickbailey.github.io/backbone.marionette/docs/backbone.marionette.html You will find that serializeData is being used just before rendering the template So by overriding it, like below you can format the object values any way you want before rendering serializeData():any { var obj = super.serializeData(); obj.totalEnergy = Math.round(obj.totalEnergy).toFixed(0) return obj } ...
angularjs,cordova,typescript,visual-studio-2015,visual-studio-cordova
Could someone share me the steps about how to add AngularJS in the TypeScript Cordova project of VS2015RC? Add angular.js Get definitions for angular : https://github.com/borisyankov/DefinitelyTyped/blob/master/angularjs/angular.d.ts Start using TypeScript .ts files like any other angular project e.g. https://github.com/tastejs/todomvc/tree/gh-pages/examples/typescript-angular ...
javascript,angularjs,typescript
I don't believe that it is possible to do this, which may seem like bad news. But I have good news. You don't need to do this, because setting useXDomain to true has no effect. In fact, useXDomain is not even really a thing in Angular. Here is a great...
The primitive type of a string is string and not String. Change the interface accordingly: interface TestObj { name: string; } String is for the String object while string is for the primitive type. For example: var obj: any = {}; var strObj = new String("test"); // typed as String...
angularjs,typescript,angular2,typescript1.5
Your issue is that the documentation is not in sync. If you followed the documentation for installation recently then it would have installed the typings for latest version alpha26, which has a lot of broken changes. And the documentation uses a23 version with that version of code. You can either...
Since you are passing the function to someone else to call in .then(this.activateView); you need to preserve the context yourself, best if you do : .then((view)=>this.activateView(view)); More about this : https://www.youtube.com/watch?v=tvocUcbCupA...
typescript,resharper,ecmascript-6
It's nothing complicated. It's always better to use const over let (and definitely var), since const makes it a bit easier for other coders, or you when you come back to the same code in the future, to understand what is going on, since you only have to look at...
javascript,typescript,angular2
I found the issue. Apparently, its a bug to be fixed in alpha 27. See this bug report: https://github.com/angular/angular/issues/1913 Angular2 uses zonejs to know when to start the digest cycle (the dirty checking and update the view). As of now, zonejs is not triggered after fetching data with the new...
javascript,internet-explorer-8,internet-explorer-7,typescript,angular2
Angular 2 will only support modern browsers: Modern browsers means the set of browsers known as ‘evergreen’ or always automatically updated to the latest version. Building for these browsers let us drop many hacks and workarounds that make AngularJS harder to use and develop on than it needs to be....
javascript,css,charts,highcharts,typescript
Pie center can be calculated using pie series center array (x and y coordinates), plotLeft and plotTop. Using renderer.text it is possible to add text. In redraw event additionally rendered text should be adjusted to stay in the center of pie. Example: http://jsfiddle.net/1917s4pL/ $(function () { var chart = new...
Yes, you want to use gulp or grunt. I suggest gulp, but that's a personal preference. You can use this to inject your scripts in a particular order based on your file naming convention.
javascript,jquery,html,css,typescript
Compare scrollWidth/scrollHeight with clientWidth/clientHeight of the element. if (e.scrollWidth > e.clientWidth){/*overflow*/} https://jsfiddle.net/pdrk50a6/ Edit: I do not know your root element, yet in the end it is going to be something like this. document.body.onresize = function(){ var tR = []; var tL = document.querySelectorAll('div'); for(var i=0, j=tL.length; i<j; i++) if (tL[i].scrollWidth...
You can use an anonymous interface (or whatever it is officially called) to define a function and its static fields together: interface JQuery { foo: { (options: any): JQuery; bar: <T>(input: T) => T } } Playground See also: Implementing TypeScript interface with bare function signature plus other fields...
javascript,typescript,sublimetext3,code-snippets
You have to add a typescript source to your snippets scope. <scope>source.js, source.ts</scope> There is a exemple of snippet that you can find in the TypeScript package: <snippet> <content><![CDATA[ class ${2:ClassName}${3: extends ${4:AnotherClass}} { $5 ${6:constructor}(${7:argument}) { ${0:// code...} } } ]]></content> <tabTrigger>class</tabTrigger> <scope>source.ts</scope> <description>class …</description> </snippet> ...
My best guess is that you need to change the sourceRoot config attribute to point to the correct path ;). Something like: {"version":3,"file":"Spinner.js","sourceRoot":"/scripts/", ... should do it. ...
Yes, that kind of behavior can be achieved, but in slightly different way. You just need to use typescript interface, like: interface IValue { prop: string } interface MyType { [name: string]: IValue; } that will be used for example like: var t: MyType = {}; t['field1'] = { prop:...
Settings "out":"public/all.js" and "module":"commonjs" are mutually exclusive. You should either: Use internal modules and let the compiler concatenate output file for you (remove module setting from config); @basarat would advise you against it, but I think it's not that bad, especially for small projects. Use external modules and concatenate output...
I'd like get the best of both world by using TypeScript to organize my code then use babels ES6 features like asyc/await and others. Is this possible. Not out of the box. I would recommend against it unless you are willing to start compiler hacking yourself. Reason is that...
this is of the wrong type (window) and not the instance of the class. The best way to fix It is by using an Arrow function to capture the this reference like below: private clickListener(target: JQuery): void { (target).on("click touchend", () => { if (!(target === (this.body))) { event.preventDefault(); event.stopPropagation();...
angularjs,angularjs-directive,typescript
So I found a way to get it to work but it is not as elegant as I would have liked. angular.module('formDirectives', [], function($compileProvider){ $compileProvider.directive('catElement', ($compile) => { return new Element($compile); }); }) ...
You need to import NgSwitchWhen and NgSwitchDefault, add these to the import statements
I had the same problem. It was a wrong PATH variable to the TypeScript compiler. (try to type "tsc -v" in a command window). The tsconfig.json is supported in TypeScript version 1.5. My PATH variable was set to version 1. When I changed the system PATH variable to the updated...
Using that dialog, I downloaded the node and express type definitions and can see them in the External Libraries section of my project. However, I still get the same error about "require" That dialog gets TypeScript definitions to use with JavaScript. You need to download the typescript definitions manually...
The most likely answer is that val is a string containing the JSON you see in the console. If it were an object, the console output would look different. It looks like you need to put a JSON.parse in there. You haven't shown the original TypeScript, but in the JavaScript...
This error arises from the fact that you have created a class-level method filterObjects() and use it in another context. TypeScript compiler doesn't know about the intended use of this method, it decides that you're going to use it in the Sample context: sample.filterObjects(). You have at least 2 different...
asp.net,visual-studio,visual-studio-2013,typescript
The problem I ran into, as you'd expect, is that the entire .js file is executed, and not just the module(s) that I need my page to execute. You shouldn't have code randomly put at a global level. The global level of your code be just functions and class...
javascript,requirejs,typescript
IMO classes in TypeScript should be used only if you need multiple instances with data associated to each instance. A Helper is usually just a bunch of static methods. Therefore I suggest to use a module instead (untested): Shared/ModalHelper.ts module ModalHelper { export function saySomething(something: String) { alert(something); } }...
javascript,typescript,aurelia,systemjs
You may want to use d.ts definition files for registration with TypeScript Definitely Typed registry for use with tsd package manager. You can find different implementations on github, for example here or here. Also this tutorial might be useful.
mdCurrencyService.get() should be implemented as an asynchronous service returning a promise. It can be utilized this way: mdCurrencyService.get().then(function (currencies) { // process result here $scope.currencies = currencies; }); ...
Your declaration says there is a module named random-string with a function named randomString within it... So your usage should be: console.log(randomString.randomString({ length: 10 })); console.log(randomString.randomString()); If the module does actually supply the function directly, you should adjust your definition to do the same: declare module "random-string" { function randomString(opts?:...
javascript,angularjs,typescript
The reason is because action function being a part of the object (literal) is not an instance of the actual class that implements the reference to its action property, search @ private actionItems:IActionItem[] = [{ name: 'Search', icon: 'magnifier', action: this.search, //<-- this one className: 'visible', order: 2 } ];...
TypeScript's handling of this in arrow functions is in line with ES6 (Read: Arrow Functions). Due to that specification, it would be inconsistent for it to act any other way. If you want to access this of the current function, then you can use a regular function. For example, change:...
angularjs,typescript,angular-http-interceptors
Notice the "request" vs. "Response". The former will be called. The latter will not. JavaScript is case sensitive. Response is not the same as response. You need to keep it lowercase. When the functions are correctly called, the "this" object refers to the global window and not the object....
Adding these files to the head will give you the latest working version of Angular2. <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.26/angular2.dev.js"></script> Source: Angular.io: 5 Minute Quickstart...