有谁知道你是否可以删除html代码中留下的角度注释?
例如:如果我使用ngRepeat并且没有要重复的项目,AngularJS会离开:
<!-- ngRepeat: post in posts -->
Run Code Online (Sandbox Code Playgroud) 我不明白为什么回调被立即调用,没有任何延迟,我已经阅读了文档,它说它解析css以检索转换持续时间.
但它似乎不起作用,这是我的代码:
这是我的幻灯片指令:
'use strict'
class SlideController
constructor: ($log, $scope) ->
console.log 'controller init.'
class Slide
constructor: ($log,$animate) ->
link = (scope, element, attrs) =>
scope.$watch 'slide.animation', (newValue,oldValue)->
$animate.addClass element,'enter-right',()->
console.log 'Animation ended!'
return {
link
controller: ['$log', '$scope', SlideController]
replace: true
restrict: 'E'
scope:
slide: '='
templateUrl: '/views/directives/postSlide.html'
transclude: true
}
angular.module('app').directive 'postSlide', ['$log','$animate', Slide]
Run Code Online (Sandbox Code Playgroud)
这是我的css:
.post-slide.enter-left, .post-slide.leave-left, .post-slide.enter-right, .post-slide.leave-right{
position:absolute;
left:0px;
top:0px;
}
/**
Enter/leave right
**/
.post-slide.enter-right {
-webkit-animation:0.5s enter-right;
animation:0.5s enter-right;
z-index:100;
background-color:darkgreen;
}
.post-slide.leave-right { …Run Code Online (Sandbox Code Playgroud) 有没有办法解释具有我的指令作为属性的div的内容:
例如:
<div my-directive>{{1+1}}</div>
Run Code Online (Sandbox Code Playgroud)
我的链接功能如下所示:
link = (scope, element, attrs) =>
interpretedString = element.text()
Run Code Online (Sandbox Code Playgroud)
在这个例子interpretedString 中等于{{1+1}}而不是2
任何帮助?在scope.$eval求值的属性,但是如果我想评价一个指令的文字是什么?
谢谢