2017-05-04 48 views

回答

0

是否包含jQuery和angular的库? 看来你没有把它包含到你的头标签中。

<html> 
    <head> 
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.9/angular2.min.js"></script> 
    <script> 
     $(document).ready(function(){ 
     alert("Hello World"); 
     }); 
    </script> 
    </head> 
    <body> 
    <h3>Hello WORLD!</h3> 
    </body> 
</html> 
+0

我已经将它包含在_Layout.cshtml文件中,但它仍然不起作用。 –

+0

你看看开发工具日志吗?知道是否有一些错误指出? – Nel

+1

控制台没有错误。它是Angular2,我使用的是由dotnet提供的SPA模板,所以脚本的引用是在其他地方完成的,我不太确定它在哪里! –