小编Ter*_*for的帖子

在td relative中的转换元素使表闪烁

td{position: relative}包含元素(<i>)的组合transitionChrome(版本54.0.2840.71 m,windows 10)浏览器中切换1,2,3在下面的片段(边框,背景)时使表闪烁(边框和背景).

这是期望的行为,错误,还是可以用一些CSS来解决?

(我需要有位置,因为其他代码也依赖它)

var app = angular.module('app', []);
app.controller('testCtrl', function($scope) {
  $scope.bodys = [1, 2, 3];
});
Run Code Online (Sandbox Code Playgroud)
table,
tr,
td {
  position: relative;
}
td{
border-top: 1px solid darkgreen !important;
}
table {
  table-layout: fixed;
}
.glyphicon-chevron-right {
  transition: transform .3s;
  cursor: pointer;
}
.toggled {
  transform: rotate(90deg);
}
.odd {
  background: lightgreen;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<body ng-app="app">
  <table ng-controller="testCtrl" class="table">
    <tbody ng-repeat="b in bodys">
      <tr …
Run Code Online (Sandbox Code Playgroud)

html css google-chrome angularjs twitter-bootstrap-3

11
推荐指数
1
解决办法
626
查看次数

$ templateCache,$ templateRequest,ngInclude一起玩好(呃)

我试图在第一页视图中获取所有部分内容,以便在应用程序查看期间不下载任何html.

一种方法是使用模板index.html.

<script type="text/ng-template" id="templateId.html">
  <p>This is the content of the template</p>
</script>
Run Code Online (Sandbox Code Playgroud)
  • 这种方式是你有超过5个模板index.html文件变得难以管理并打破了项目的模块结构.

另一种方法是将html保存在.js文件中,最有可能在文件中app.js

myApp.run(function($templateCache) {
  $templateCache.put('templateId.html', 'This is the content of the template');
});
Run Code Online (Sandbox Code Playgroud)
  • 我认为.js文件不是html代码的地方,而且还有与使用它相同的问题index.html.

我想做的是,在不同的文件中有模板,所以我可以保留我的模块结构并在索引上预加载它们.

这就是我现在拥有的.

var cmsAppFirstRun = function ($templateCache, $templateRequest, $rootScope) {
    $templateRequest('views/common/top-bar.html').then(function (response) {
        $templateCache.put('top.bar', response);
        $rootScope.templatesDone = true;
    });
};

angular.module('cmsApp').run(cmsAppFirstRun);
Run Code Online (Sandbox Code Playgroud)

和HTML

<div ng-include="'top.bar'" ng-if="$root.templatesDone"></div>
Run Code Online (Sandbox Code Playgroud)

这样做是否有更性感,更有棱角的方式?

angularjs angularjs-ng-include

6
推荐指数
1
解决办法
6972
查看次数