浅谈angularJs函数的使用方法(大小写转换,拷贝,扩充对象)
时间:2021-06-18 08:45:31|栏目:AngularJS|点击: 次
如下所示:
<!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
本文标题:浅谈angularJs函数的使用方法(大小写转换,拷贝,扩充对象)
本文地址:http://www.codeinn.net/misctech/144028.html