angularjs,js调用angularjs中的方法和参数
2014-12-16 16:36
162 查看
@{ Layout = null; } <!DOCTYPE html> <html ng-app="my_app"> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <script src="~/Scripts/jquery-1.10.2.min.js"></script> <script src="~/Scripts/angular.min.js"></script> <script type="text/javascript"> var app = angular.module("my_app", []); app.controller('my_controller', function ($scope) { window.scope = $scope; var vm = $scope.vm = {}; vm.students = [ { id: 1, name: '张一' }, { id: 2, name: '李二' }, { id: 3, name: '王三' }, { id: 4, name: '马四' }, { id: 5, name: '鬼五' } ]; $scope.getStudentLength = function (items) { alert(items.length); } }); </script> <script type="text/javascript"> $(function () { var $scope = window.scope; var vm = $scope.vm; $scope.getStudentLength(vm.students); }); </script> </head> <body ng-controller="my_controller"> </body> </html>
相关文章推荐
- JS调用后台带参数的方法
- 【转】 JS调用后台带参数的方法
- Flex调用js方法传递参数
- JS调用OC简单实例-传递一个或者多个参数给oc方法
- java和js中不定项参数调用方法
- JS调用后台带参数的方法
- 使用ExternalInterface调用JS方法-传参数、有返回值!
- dwr调用参数为 对象数组 的方法(js中直接传递obj数组)
- EXT.NET-gridpanel 行双击事件,js带参数调用后台方法
- js调用方法传递变量作为参数的问题
- JS调用后台带参数的方法
- gridpanel 行双击事件,js带参数调用后台方法
- JS调用后台带参数的方法
- js中方法定义的时候没有定义参数,调用的时候可以传参吗?
- 开发日志:onclick调用js方法传递多个使用struts标签获取的参数
- JS调用后台带参数的方法
- 调用js方法传绑定参数
- 让JS中settimeout、setInterval调用传递参数 的好方法
- DWR中js调用Java方法的参数及返回值
- js方法名通过参数传递调用实例