Code Monkey home page Code Monkey logo

ng-layer's Introduction

概述

layer的angular封装,同时增加异步载入content的功能

下载

  1. 推荐使用 bower install ng-layer
  2. 当然也可以直接复制 ng-layer.js 文件

使用

①. 引入layer自身,再引入ng-layer

②. 注册模块

angular.module('app', ['ng-layer']);

③. 使用

支持标准方式 和 controller as方式(感谢@wandergis)

标准方式

var layerId = layer.open({
    contentUrl: 'modules/home/index.html',  // 额外增加的方法,正如其名
    scope: $scope
});

// layer.close(layerId); 

controller as方式

var layerId = layer.open({
    // contentUrl: 'modules/home/index.html',当然也还可以用原来的content
    content: '<div controller="appCtrl as vm">{{vm.name}}</div>'
});

// layer.close(layerId);

具体可以查看demo文件

兼容

理论上支持任何版本的layer,除非layer更改了核心功能

ng-layer's People

Contributors

think2011 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ng-layer's Issues

layer.open时iframe的url地址在高版本浏览器中会请求2次

chrome浏览器升级后,总会出现访问两次url地址的情况,第一次被强制取消,第二次才成功。但是后台服务器仍然执行了第一次的请求。

var oldOpen = _open(deliver);//第一次
var $el = $('#layui-layer' + oldOpen);
var $content = $el.find('.layui-layer-content');
var injectScope = deliver.scope || $rootScope.$new();

$content.replaceWith($compile($content[0].outerHTML)(injectScope));//第二次

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.