html - Problema with ng-click function -
i trying make product configurator website. i'm using mean @ point have problem angularjs.
i proceed explain program. in application have 3 buttons first step of configuration.
when click one, angularjs send web next 3 buttons (the values of buttons depends on first 1 click). , here arrives problem, last buttons doesnt seems work.
after clicking first button call function $scope.getoption2
, returns this:
htmlsstring= '<div><button id="btns2-1" ng-click= getoption3(1)>1</button></div>'+ '<div><button id="btns2-2" ng-click= getoption3(2)>2</button></div>'+ '<div><button id="btns2-3" ng-click= getoption3(3)>3</button></div>';
and way print on screen: $scope.option2 = $sce.trustashtml(pruebahtml);
but function $scope.getoption3
never called when click in 1 of buttons.
i have simplified code, essential part here. hope can see problem.
appending elements not angular way, , frowned upon. angular not know of new buttons, because cannot manipulate dom in way. $compile elements again, maybe should have buttons in template begin with, show them ngshow. maybe better yet, see if there directive out there can want - or roll own.
look http://docs.angularjs.org/api/ng.$compile details on $compile.
Comments
Post a Comment