2016-09-21 2 views
0

Ich habe alle Einstellungen einschließlich Hinzufügen von Typoskript-Compiler in Webstorm, Installation von tsd mit Npm und alle anderen Sachen.eckig mit Typoskript Fehler, kann nicht finden, Name Winkel

ich noch Fehler bekommen 'Kann nicht finden Name Angular'

tsd.json

{ 

    "version": "v4", 
    "repo": "borisyankov/DefinitelyTyped", 
    "ref": "master", 
    "path": "typings", 
    "bundle": "typings/tsd.d.ts", 
    "installed": { 
    "angularjs/angular.d.ts": { 
     "commit": "70a693ec17c7ae4b9b7c1fa6c399ac3e82e3843e" 
    }, 
    "jquery/jquery.d.ts": { 
     "commit": "70a693ec17c7ae4b9b7c1fa6c399ac3e82e3843e" 
    } 
    } 
} 

sorting.html

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Title</title> 
</head> 
<body> 
{{$ctrl.mytest}} 
</body> 
</html> 

sorting.ts

var app = angular.module('myApp', []); 
app.component('sorting', { 
    templateUrl: 'modules/sorting/sorting.html', 
    controller: SortingClass 
}); 

class SortingClass { 

    public mytest: string = 'abcd'; 

} 

Index. html

<!DOCTYPE html> 
<html> 
<head lang="en"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    <meta charset="UTF-8"> 
    <title> Facility</title> 
    <script type="text/javascript" src="bower_components/angular/angular.js"></script> 
    <script src="modules/sorting/sorting.js" type="text/javascript"></script> 
</head> 
<body> 
</body> 
+0

Mögliche Duplikat - (https [Fehler beim Abrufen kann nicht Namen 'eckig' gefunden]: // stackoverflow.com/questions/29915175/getting-error-cannot-find-name-angular) –

Antwort

-2

Mein Freund, Sie haben viele Syntaxfehler. Bitte werfen Sie einen Blick auf die Grundlagen der eckigen js. Versuchen Sie zunächst diesen Code. Dies sollte funktionieren:

Index.HTML

<!DOCTYPE html> 
<html ng-app="myApp"> 
<head lang="en"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    <meta charset="UTF-8"> 
    <title> Facility</title> 
    <script type="text/javascript" src="bower_components/angular/angular.js"></script> 
    <script src="modules/sorting/sorting.js" type="text/javascript"></script> 
</head> 
<body ng-controller="sorting as ctrl"> 
    <div> {{ctrl.mytest}} </div> 
</body> 
</html> 

Sorting.ts

module xyz { 
var angular: any; 
var app = angular.module('myApp', []); 
app.controller('sorting', SortingClass); 

public class SortingClass { 
    public mytest: string = 'abcd'; 
} 
} 
+0

Immer noch nicht funktioniert, ich bekomme dies: {{$ ctrl.mytest}} im Browser – Zakk

+1

ist nicht $ Ctrl. Es ist nur Strg. Kopieren Sie den Code und verifizieren Sie ihn –

Verwandte Themen