Typescript Directives error “Property IScope dont exist on type ‘IAngularStatic”


I’m writing a Angular Directive with typescript to able share a scope item, i create a interface that inherits from ng.IScope, but Visual Studio Code show this warning: “Property IScope dont exist on type IAngularStatic’, I am using the angular.d.ts type definition file from definitelytyped.org.

Property IScope dont exist on type 'IAngularStatic'Property IScope dont exist on type 'IAngularStatic'

module kingApp.Directives {

export interface IMenuDirective: ng.IScope {

}

export function MenuDirective(): ng.IDirective
{

    return {
        templateUrl: 'shared/menu/menu.html',
        controller: Controllers.Home.HomeController              
    }
}
angular.module("kingApp").directive('menu',MenuDirective);

}

How i can share data from scope to my current directive ?

 

 

 

Resovled like this:

You wrote export interface IMenuDirective: ng.IScope {. It should be export interface IMenuDirective extends ng.IScope {. The compiler error is misleading.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s