Angularjs 拒绝从';*执行脚本。ts';因为它的MIME类型(';video/vnd.dlna.mpeg tts';)不可执行
我是打字新手。 我有一个angularjs控制器,我正试图将其转换为typescript控制器 首先,我声明了控制器和模块Angularjs 拒绝从';*执行脚本。ts';因为它的MIME类型(';video/vnd.dlna.mpeg tts';)不可执行,angularjs,typescript,Angularjs,Typescript,我是打字新手。 我有一个angularjs控制器,我正试图将其转换为typescript控制器 首先,我声明了控制器和模块 /// <reference path='../../Scripts/typings/angularjs/angular.d.ts' /> /// <reference path='../../Scripts/typings/jquery/jquery.d.ts' /> 'use strict' interface IRouteParams
/// <reference path='../../Scripts/typings/angularjs/angular.d.ts' />
/// <reference path='../../Scripts/typings/jquery/jquery.d.ts' />
'use strict'
interface IRouteParams extends ng.route.IRouteParamsService {
propertyAddress: string;
}
class Controller1 {
public propertyAdd: string;
constructor($scope: any,
$routeParams: IRouteParams,
ServicesFactory,
growl,
blockUI,
IMAGE_RELATED_MESSAGES,
BUSY_MESSAGES,
$timeout: ng.ITimeoutService,
$modal,
Lightbox,
$filter) {
this.propertyAdd = $routeParams.propertyAddress;
}
}
angular.module('Controller').controller('Controller1', Controller1);
//
///
“严格使用”
接口IRouteParams扩展了ng.route.IRouteParamsService{
propertyAddress:字符串;
}
类控制器1{
公共属性add:string;
构造函数($scope:any,
$routeParams:IRouteParams,
服务工厂,
咆哮,
布洛基,
与图像相关的信息,
繁忙的信息,
$timeout:ng.ITimeoutService,
$modal,
灯箱,
$filter){
this.propertyAdd=$routeParams.propertyAddress;
}
}
角度。模块(“控制器”)。控制器(“控制器1”,控制器1);
当我在浏览器中运行此代码时,会出现以下错误
拒绝从“”执行脚本,因为其MIME类型('video/vnd.dlna.mpeg tts')不可执行
难点是什么?您必须将您的typescript代码转换为常规javascript代码。TypeScript不应直接在浏览器中运行 使用
tsc
编译器生成如下javascript:
tsc helloworld.ts
更多的细节