javascript - Data not rendering -
I have a website that displays data in the list, which is filtered when applied to a filter , Then I want him to be added to the URL as a parameter. I wrote a service for:
app.factory ('urlfilter', ['$ location', function ($ location) {var urlParams = $ location.search (); Return function ($ Scope, myUrlParams) {angular.forEach (myUrlParams, Function (Ultimate) {$ Scope (param) = isset (urlParams [Ultimate])? UrlParams [Param]: 0; $ scope. $ Watch (Ultimate, Work ) {If (isset (value)) {$ location.search (param, value)}}}}}}}}}}}])); urlFilter is called in the last controller: urlFilter ($ radius, ['company_id']); I get a resource in the controller and set the company_id on the clock to update company_id using a dropdown is. Whenever company_id is updated, I refresh the resource: $ scope. $ Watch ('company_id', function (company id) {if (! Isset (companyId)) {return;} Api.resource.query ({company_id: companyId}, function (data) {$ scope.resources = data;} );}); This approach works perfectly on my local host environment, but whenever I upload it for production, it works if I change the company then resources are necessary. And the URL parameter is set correctly if I refresh the page with the URL parameter, then I know that using the Chromeus debugging tool, right, company_id and the reset is OK Money is necessary. However, the view is not updated, i.e. the empty resource list and the initial company company is not set up in the drop down. What have I done wrong? Is there a better way? I'm not using angular routing. Note: isset () is a function that I wrote myself. When using values collected from
$ location by adding parseInt () = "text-post" itemprop = "text"> , that is:
$ scope (param) = release (urlParam [ultimate])? ParseInt (urlParam [Ultimate]): 0;
Comments
Post a Comment