如下所示:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="angular.min.js"></script> </head> <body> <div ng-app="module" ng-controller="ctrl"> </div> <script> var m = angular.module('module', []); m.controller('ctrl', ['$scope', function ($scope) { //angular.version获取angular版本 console.log(angular.version); //angular.uppercase()转成大写 console.log(angular.uppercase('AngularJs')); //angular.lowercase()转成小写 console.log(angular.lowercase('AngularJs')); var obj = {name: '泠泠在路上'}; var obj2 = {}; angular.copy(obj, obj2);//深拷贝 obj2.name = '泠泠'; console.log(obj.name); console.log(obj2.name); //angular.extend 扩充obj3对象填充数据 var obj3 = {'name': '博客网'}; angular.extend(obj3, {url: 'http://blog.csdn.net/u012396955', 'web': '泠泠在路上'}); console.log(obj3); }]); </script> </body> </html>
以上这篇浅谈angularJs函数的使用方法(大小写转换,拷贝,扩充对象)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持找一找教程网。