javascript - 如何在我的Grails应用程序的单个页面上使用AngularJS,并在其他页面上使用常规JS?

标签 javascript angularjs grails

我现在已经花了几个小时,无法破解。

我试图在网上实现一个很棒的AngularJS示例到我的应用程序中,而到目前为止,我的前端是完全普通的JS。

我已经安装了管道插件,并将文件放在相应的文件夹中:
http://i.imgur.com/cAPA6ui.png

AngularJS似乎正确且以正确的顺序加载,但是在开发工具中,它的确在js文件名后说了'compile = false'吗?
另请:http://i.imgur.com/qHEWwc9.png

当我单击当前 View 之一时,我试图重定向到新的AngularJS页面,我认为下面的代码将会这样做:

app.config(['$routeProvider', function($routeProvider) {
//$locationProvider.html5Mode(true);
$routeProvider
  .when('/view', {
      templateUrl: 'assets/index.html'
  })

那么可以在我的应用程序中同时使用AngularJS和常规JS吗?
如果是这样,我该如何从JS移到AngularJS页面?

非常感谢您的协助。

最佳答案

只需转到url http://localhost:8080/#/view,但是如果启用html5Mode,则只需转到http://localhost:8080/view即可查看它

关于javascript - 如何在我的Grails应用程序的单个页面上使用AngularJS,并在其他页面上使用常规JS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41925906/

相关文章:

javascript - AngularJS 部分 HTML 无法使用 jquery lib(在 index.html 中加载)

javascript - 将 Grails GSP 自定义标记转换为 AngularJS 指令

Grails Eclipse 插件

javascript - Highchart 导出未在系列数据标签上应用样式(字体大小)

javascript - iDangerous Swiper 最后单击的元素回滚 slider

javascript - SignalR 在一段时间后停止工作

java - 如何从 Javascript 调用 GWT java 函数?

javascript - Angular js 不起作用

php - Laravel + AngularJs : cant execute SQL command

mysql - Hibernate 事件监听器未捕获事件