繁体   English   中英

如何包含Jquery插件AngularJs Multipage应用程序

[英]How to Include Jquery plugin AngularJs Multipage application

我正在AngularJs中开发一个多页应用程序。 我的要求是从侧边栏菜单的主列表中打开一个子列表。 子列表随着过渡而崩溃。 我已经有一个Jquery插件。 运行良好。 但是当在Angular应用程序中使用$ routeprovider时,它不再起作用。

加载jQuery的功能是

$.sidebarMenu($('.sidebar-menu'));

侧边栏是所有页面共有的。

我的app.config如下

app.js

app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.
     when('/web', {
         templateUrl: 'templates/web.html',
         controller: 'webctrl'
     }).
     when('/login', {
         templateUrl: 'templates/login.html',
         controller: 'webctrl'
     }).
     when('/register', {
         templateUrl: 'templates/register.html',
         controller: 'webctrl'
     }).
     when('/account', {
         templateUrl: 'templates/account.html',
         controller: 'accountctrl'
     }). 
     when('/subtran', {
         templateUrl: 'templates/subtran.html',
         controller: 'subtranctrl'
     }).
     otherwise({
         redirectTo: '/web'
     });
}]);

我在哪里包含上述jquery函数

当我将脚本作为脚本包含在html主页中时,它引发了JavaScript运行时错误。

index.html

<script>
   $.sidebarMenu($('.sidebar-menu'));
</script>

帮我。

问题已解决。 我只是将js脚本从特定文件复制到,而不是使用函数调用它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM