angularjs - How to load returned html after $http.post -


sorry if has been asked already, can't find answer!

i'm posting form data using angular, , expecting backend return html page. how load page?

$http.post(generate_practice_exam_url, data).then(   function(data){     # data contains html of page i'd load/redirect     # $window.loadashtml(data); <-- want   } ); 

clarification: know can return url server , pull $location.path(data.data). want return html of next page, , load immediately, avoid making request $location.

actually should use server data storage. should return json , should use angular directives show data. if need html server , show should create directive that.

there "link" function can access html element , insert html like

directive('mydirective', function($http){   return {     link:function(scope, elem){           $http.get('your url').then(function(htmlresponse){elem.html(htmlresponse)});          }  }; }); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -