项目总结

来源:互联网 发布:日俄战争全史淘宝 编辑:程序博客网 时间:2024/06/05 06:53

1、treeGrid

https://github.com/khan4019/tree-grid-directive.git

2、$timeout()

$timeout(fn,[delay],[invokeApply])$timeout.cancel([promise])

3、angular.then()

angular.then(callback,errback) 第一个用来处理“resolved”和“success”事件;第二个用来处理“rejected”和“failure”事件。

4、ngDialog、myDialog

https://github.com/likeastore/ngDialog

5、ztree

$.fn.zTree.init($("#treeDemo"), setting, $scope.rawTreeData);

6、给scope变量赋值的办法

$parse()单独的服务scope.$eval() 当前作用域

7、路由配置相关
viewName@stateName

.state('index.CarPage', {    url: '/CarPage',    views: {         'main@index': {               templateUrl: 'assets/views/CarPage.html',               controller:'carPageController',                }            }

})

8、layer.js

    layer.load()    layer.closeAll()

9、H5的filereader文件上传

10、$http内建服务的用法

$http({   method:'',   url:'',   headers:{  ClientType:'Web',  Equiment:'',      },   data:data}).success(fn).error(fn)//返回promise对象promise.then(function(resp){},function(resp){})或者:promise.success(function(data,status,config,headers){//处理成功的响应});promise.error(function(data,status,hedaers,config){//处理失败后的响应});$http.get('',{cache:true})$http.jsonp('')

11、$window

12、angular.element()将DOM元素包装成jQuery元素

    //调试        angular.element($0).scope()    

13、$script.js异步加载器

14、ng-include

ng-include="'lovestory.html'"//变量

15、config的参数:
$locationProvider:

  • html5模式
  • hashPrefix前缀

    $locationProvider.html5Mode(true).hashPrefix('!');$location.path();$location.path('/newValue');$location.path('/newValue').search({key:value}) // 改变url而不添加新的历史记录: $location.path('/someNewPath').replace();

16、data-ng-让网页对html5有效

17、run()方法的应用:

18、x-www-form-urlencoded 名称/值对
19、encodeURIComponent()
20、$q内置服务,异步的执行函数

   $q.defer()延迟 延迟对象   deferred.promise返回当前任务完成的结果   deferred.resolve(value)成功解决   deferred.reject(reason)   $q.all()用于执行多个异步任务回调

21、前端博客
http://sentsin.com/all/

22、ngModel

   ngModel.$viewValue  视图的实际值    ngModel.$modelValue ng-model的值   ngModel.$setViewValue('')   ngModel.$parsers验证和转化   ngModel.$formatter格式化和转化   ngModel.$viewChangeListeners   ngModel.$setPristine()   ngmodel.$setValidity   ngModel.$render()   ngModel.$error   ngModel.$name   ngmodel.$setValidity('flag',布尔值)   参考:http://www.cnblogs.com/liulangmao/p/4110137.html

23、angular与javascript的区别
都可以包含字母、操作符、变量
不同之处:

javascript的执行环境在全局作用域中ng是在一个scope对象中不能在ng表达式({{}})中使用条件判断循环或异常不能在ng表达式中声明方法不能创建正则表达式的实例不能使用new操作符创建对象如果要运行一些比较复杂的JavaScript表达式,应该封装成$scope的一个属性在控制器当中,并在视图中调用。

24、WdatePicker日期插件

$dp.hide();

25、cityPicker

26、$compile和指令的compile函数的区别

$compile动态显示html内容

总之就是用$compile服务创建一个directive ‘compile’,这个complie会将传入的html字符串或者DOM转换为一个template,然后直接在html里调用compile即可。

 $compileProvider.directive('compile',function($compile) {  // directive factory creates a link function  return function(scope, element, attrs) {    scope.$watch(      function(scope) {         // watch the 'compile' expression for changes        return scope.$eval(attrs.compile);      },      function(value) {        // when the 'compile' expression changes        // assign it into the current DOM        element.html(value);        // compile the new DOM and link it to the current        // scope.        // NOTE: we only compile .childNodes so that        // we don't get into infinite loop compiling ourselves        $compile(element.contents())(scope);      }    );  };});<div ng-controller="GreeterController">  <input ng-model="name"> <br>  <textarea ng-model="html"></textarea> <br>  <div compile="html"></div></div>

这里写图片描述![](http://img.blog.csdn.net/20161116180613215)

这里写图片描述

0 0
原创粉丝点击