立即注册 登录
PhoneGap中文网 返回首页

zcysyr的个人空间 http://www.phonegap100.com/?65806 [收藏] [复制] [RSS]

日志

html模块化--标签的重用性

已有 792 次阅读2016-4-15 18:39 |个人分类:angular| 标签

 <!-- navbar -->
  <div data-ng-include=" 'tpl/blocks/header.html' " class="app-header navbar">
 
  <!-- / navbar -->

  <!-- menu -->
  <div data-ng-include=" 'tpl/blocks/aside.html' " class="app-aside hidden-xs {{app.settings.asideColor}}">
 
  <!-- / menu -->

  <!-- content -->
  <div class="app-content">
    <div ui-butterbar>
    <a href class="off-screen-toggle hide" ui-toggle-class="off-screen" data-target=".app-aside" ></a>
    <div class="app-content-body fade-in-up" ui-view>
   
 
  <!-- /content --> 

uiModule  指令

  .directive('uiModule', ['MODULE_CONFIG','uiLoad', '$compile', function(MODULE_CONFIG, uiLoad, $compile) {
    return {
      restrict: 'A',
      compile: function (el, attrs) {
        var contents = el.contents().clone();
        return function(scope, el, attrs){
          el.contents().remove();
          uiLoad.load(MODULE_CONFIG[attrs.uiModule])
          .then(function(){
            $compile(contents)(scope, function(clonedElement, scope) {
              el.append(clonedElement);
            });
          });
        }
      }
    };
  }])
$urlRouterProvider
            .otherwise('/app/dashboard');
        $stateProvider            
            .state('app', {
                abstract: true,
                url: '/app',
                templateUrl: 'tpl/app.html'
            })
            .state('app.dashboard', {
                url: '/dashboard',
                templateUrl: 'tpl/app_dashboard.html'
            })
            .state('app.ui', {
                url: '/ui',
                template: '<div ui-view class="fade-in-up">
'
            })
            .state('app.ui.buttons', {
                url: '/buttons',
                templateUrl: 'tpl/ui_buttons.html'
            })
            .state('app.ui.icons', {
                url: '/icons',
                templateUrl: 'tpl/ui_icons.html'
            })
            .state('app.ui.grid', {
                url: '/grid',
                templateUrl: 'tpl/ui_grid.html'
            })            
            .state('app.ui.bootstrap', {
                url: '/bootstrap',
                templateUrl: 'tpl/ui_bootstrap.html'
            })

头晕

不解

扯淡

搞笑

欠扁

超赞

支持

难过
收藏 邀请 举报

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

关闭

站长推荐 上一条 /1 下一条

ionic4视频教程

Archiver|手机版|小黑屋| PhoneGap中文网 ( 京ICP备13027796号-1 )  

GMT+8, 2024-5-20 19:44 , Processed in 0.036379 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部