Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refused to execute script from '*.ts' because its MIME type ('video/vnd.dlna.mpeg-tts') is not executable

I am new to typescript. I have an angularjs controller which I am trying to convert to typescript controller.

To start with I declared the controller and module

    /// <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);

when I run this code in browser I get following error

Refused to execute script from 'http://localhost/....../Controller1.ts' because its MIME type ('video/vnd.dlna.mpeg-tts') is not executable.

whats is the pain point?

like image 822
MARKAND Bhatt Avatar asked Mar 08 '23 12:03

MARKAND Bhatt


1 Answers

You have to transpile your typescript code to a regular javascript code. TypeScript is not supposed to run directly in the browser.

Use tsc compiler to produce javascript like this:

tsc helloworld.ts

More details on the official site.

like image 85
shadeglare Avatar answered Mar 11 '23 11:03

shadeglare