nested directives in angularjs -


I have an instruction with an instruction in it detail of parent instruction (extension tile) (a CSS class Clicking on the nested directive (click address) will close the expanded tile (hypothetically, to remove the CSS class animation by adding the animation + the boolean is expanded, adding tiles to the truth), and to expand the parent directive Tile + Ulian wrong extended tile)

I am unable to correctly this problem, and nested instructions how angular. Any advice appreciated.

  & lt; Li class = "gallery-tile" extension-tile & gt; & Lt; Section square = "inner-tile" & gt; & Lt ;! - Not expanded - & gt; & Lt; P class = "tile-title" ng-if = "extended tile" & gt; Not Extended & lt; / P & gt; & Lt ;! - Expanded - & gt; & Lt; Section ng-if = "extended tile" & gt; & Lt; P & gt; Extended tiles & lt; / P & gt; & Lt; Div id = "CloseBtn" ng-click = "close tile") address-click = "doctlossile ()" & gt; X & lt; / Div & gt; & Lt; / Section & gt; & Lt; / Section & gt; & Lt; / li & gt; App.controller ('TileCtrl', function ($ scope) {$ scope.expandedTile = false; $ scope.closeTile = function} {$ scope.expandedTile = false;}; $ scope.dontCloseTile = function () {$ scope .expandedTile = true;};}); app.directive ('expandingTile', [function] {return: Restrict: 'A', Controller: 'tilkton', link: function (scope, amm, ethers) {elem.bind ('click', function) {If (! Elem.hasClass ('extended')) {elem.addClass ('extended'); window.ScrollTo (0, 0); // scope.expandedTile = true; scope. $ Apply ();}}) ;}}}]); App.directive ('detectclick', ['$ document', function ($ document)) {return: '^ expandedTile', restrict: 'a', link: function (scope, elem, attrs) {elem.bind () 'Click', function (e) {e.stopPropagation ();}); $ Document.bind ('click', function () {radius. $ Apply (attrs.detectClick);}}}}}}]); Found solution.    

  & lt; Li ng-repeat = "project in projects" category = "gallery-tile" ng-square = "{expanded: expanded tile}" extension-tile & gt; & Lt; Section square = "inner-tile" & gt; & Lt; P ng-show = "expandedTile" id = "CloseBtn" ng-click = "close tile") Click outside to locate & gt; X & lt; / P & gt; & Lt; / Section & gt; & Lt; / li & gt; / * Expanded tile * / app.directive ('expandingTile', [function (return) {return: Restrict: 'a', controller: function ($ scope) {$ scope.closeTile = function (elem) {console.log ( 'Close tile') $ scope.expandedTile = false;}}, link: function (scope, amm, ethers) {elem.bind ('click', function (e) {if! (Elem.hasClass ('expanded') ) {Scope.expandedTile = true; Scope. $ Apply ();}}}}}}}])); / * Click External Click * / app.directive ('detectOutsideClick', ['$ document', function ($ document)) {return {restrict: 'a', link: function (scope, elem, attrs) {elem. Bind 'click', function (e) {e.stopPropagation ();}); $ Document.bind ('click', function () {radius. $ Apply (attrs.detectOutsideClick);}}}}}}]);    

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -

ios - Does Core Data autoupdate a many to many relationship on saving -