Javascript ng动画ng是否包含$template缓存?
好的,我有以下几点:Javascript ng动画ng是否包含$template缓存?,javascript,angularjs,Javascript,Angularjs,好的,我有以下几点: var app = angular.module('Anim',["ngAnimate"]); app.controller('ParentController',function($scope){ }); app.directive('home', function ($animate) { return { templateUrl: 'pantone-inner-home.html', restrict: 'AE', link:
var app = angular.module('Anim',["ngAnimate"]);
app.controller('ParentController',function($scope){
});
app.directive('home', function ($animate) {
return {
templateUrl: 'pantone-inner-home.html',
restrict: 'AE',
link: function ($scope, element, attrs) {
$scope.closemenu = function closemenu(){
$scope.$parent.mainmenulink = '';
};
}
};
});
app.directive('menuToggle', function () {
return {
templateUrl: 'menu-toggle.html',
restrict: 'AE',
link: function ($scope, element, attrs) {
$scope.openmenulink = function openmenulink(){
$scope.mainmenulink = 'pantone-section.html';
};
}
};
});
使用angulaJS 1.2和ng animate,我的问题是它只在从$templatecache中提取get后的第一次加载时才进行动画制作,这非常好,因为它减少了我的模板加载时间,但却破坏了我的分析。
如何保持templatecache并使用ng include templates。。。
我已经建立了一个plunkr,它复制了这个错误:
据我所知,这根本不是由于
$tempateCache
造成的。相反,它看起来更像是您的ng enter
类位于稍微错误的位置。它们应该附加到.nav
类,因为该类是执行ng include
的元素,所以应该在那里应用ng enter
样式和转换
我在这里分叉并更新了plunkr:
该死的你说得对!!!在ng include运行之后,我将如何处理自定义指令?没关系,这是一个完全不同的问题!谢谢:完成的方法是在
ng include
上提供onload
功能。此函数可以在作用域中设置一个值,该值可以与ng class
一起使用,以便将类添加到自定义指令模板中某个位置的元素中,从而允许使用ng add
/ng remove
。您亲爱的先生是一个高效的天才!!谢谢你花了这么多时间看这篇文章,很有可能它已经把我逼疯了。。。