javascript - How to call controller function from html? -


hi new angularjs , html, javascript , css please try explain answers dummys.

so, reason function "updatefilterterm" not called. variable "filterterm" remains same initialized.

like see in code page calling function 1 page displaying content of variable "filterterm" have same controller "batchmonitorctrl".

do wrong or can guide me solution problem?

here part of controller.js:

... function batchmonitorctrl($scope, batchmonitor, batchmonitorconfig, configservice, $localstorage, $timeout, flash, $routeparams) {     $scope.filterterm = '2312ab78-1e3c-48c5-82af-e38b42d704eb';      $scope.updatefilterterm = function(filterterm) {         $scope.filterterm = filterterm;     }; } ... 

and here part of bm.html:

... <span ng-switch-default     class="label label-primary {{types[charge.type].css}}"     style="cursor:pointer;padding:8px;"     onclick="$(this).popover('toggle')"     data-html='true'     data-toggle="popover"     data-trigger="manual"     data-placement="top"     title="{{&quot;common.batchstatus-ok&quot;|i18n}}"     data-content="type: {{charge.type}}<br />logicalid: {{charge.logicalid}}<br />nest: {{charge.nests}}<br />setupdate: {{ charge.setupdateobject | date:'yyyy-mm-dd hh:mm:ss' }}<br/>updated: {{ charge.updated['$date'] | date: 'yyyy-mm-dd hh:mm:ss' }}     <br/><br/><a href='#/delete-charge' class='btn btn-primary btn-block' ng-click='updatefilterterm({{charge._id}})'><span>{{&quot;common.delete-charge&quot;|i18n}}</span></a>">     <h5><strong>{{charge.logicalid}}</strong></h5> </span> ... 

and here part of dc.html use "filterterm" filter batches:

... <tr ng-repeat="batch in allbatches | orderby: 'sort' | filter: filterterm"> ... 

i not sure, think related scope inheritance. try use controlleras syntax, or other dot access technics:

| filter : obj.filterterm;  function setfilter(term){     $scope.obj.filterterm = term; } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -