last day (14 days later) » 

11:09 AM
0
A: ng-click doesn't work inside a script balise

Ben Diamantdecleare a scope (in SearchController) function, let's say: $scope.changeTime = function(val) { $scope.time = val; } and for each header change the use: <th style="width:20px;" ng-click="changeTime(0)">Journée</th>

 
Your solution doesn't work because i'm in a directive
 
You didnt mention that, where is the directive use in the html?
 
Sorry, i update the post
 
Edited answer @Mercer
 
i have declare the scope in SearchController but when i click there is nothing
 
11:09 AM
SearchController scope's variable 'time' does not change? did you change the headers? I need a clearer picture
 
i update the post
 
yo
 
can you try and change the way you call changetime
ng-click="changeTime('0')"
notice the apostrophe
 
i change but I feel that ChangeTime is not executed
 
11:13 AM
Do you have an indication that the controller is loaded succefuly and handle the DOM table?
try to set a text variable and print it in the tablr
$scope.test = "test"; // in the controller
{{test}} in the html
 
in the table HTML the var is not initialized
 
console error?
 
nothing
 
Show me the include tag of the template
I guess somewhere you have
<div ng-include="custom-footer"></div>
 
                        <script type="text/ng-template" id="custom-footer" >
is include via a script balis
 
11:21 AM
This is just the template decleration
you need to include this template somehow
This is just the template decleration
 
in the html i include the template like this:
<script type="text/ng-template" id="custom-footer" >
<div>
<table cellspacing="0" cellpadding="0" ng-controller="SearchController"
style="border:solid 1px black; font-family:verdana; font-size:12px;">
<thead>
<tr style="background-color:lightgrey;">
<th style="width:20px;" ng-click="changeTime('0')">Journée</th>
<th style="width:20px;" ng-click="changeTime('1')">Matin</th>
<th style="width:20px;" ng-click="changeTime('2')">Midi</th>
<th style="width:20px;" ng-click="changeTime('3')">Soir</th>
</tr>
in the directive i include the template like this: $.datepicker.dpDiv.append($('#custom-footer').contents().text());
 
Ok that's the problem
 
the pb is the <sccript ...> ..?
 
no
the problem is that the content you load with your jQuery append does not build the content
so the Controller is not being generated when you load the table
 
ok
there is a solution ?
 
11:26 AM
yes
you shuold use the compile service
and follow this topic as well stackoverflow.com/questions/18091262/…
 
ok, but how i attached the compile with the datapicker ?
 
They did kind of the same thing here
35
Q: AngularJS - Compiling dynamic HTML strings from database

giraffe_senseThe Situation Nested within our Angular app is a directive called Page, backed by a controller, which contains a div with an ng-bind-html-unsafe attribute. This is assigned to a $scope var called 'pageContent'. This var gets assigned dynamically generated HTML from a database. When the user flip...

just diffrent elements
I g2g, please vote for the answer if you ended up succeding or comment to me and I'll remove it
 
ok it's good i solve my pb thx bro
 

last day (14 days later) »