angularjs - Angular JS Templating -


i have template set view pages load using

app.route('/*').get(core.renderindex); 

where , renderindex function looks

exports.renderindex = function (req, res) {   res.render('modules/core/server/views/index', {     user: req.user || null   }); }; 

now when route has announcement in render different template , not index.server.view.html

app.route('/:shopid/:locationid/announcement/*').get(core.renderannouncement);    exports.renderannouncement = function (req, res) {       res.render('modules/core/server/views/announcement', {     user: req.user || null,   }); }; 

the reason why i'am doing because need change meta tags on page i.e. need set variables on view before page renders comes controller.

my question how can access variables in server.view.html file?

<!doctype html> <html lang="en" ng-controller="offercontroller"  ng-init="getannouncement()"> <head>   <meta charset="utf-8">   <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">   <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">   <base href="/">   <title>{{ gettitle }}</title> 

like gettitle setting getannouncement method of offercontroller.

this works if set different announcement.client.view.html file , in server file extend it

in case stuck , needs here how did

 app.get('/:shopid/:locationid/announcement/*',function(req,res,next){     async.waterfall([       function (done) {         var resultsobj = '';           var httptransport = 'http://';         if (config.secure && config.secure.ssl === true) {           httptransport = 'https://';         }          var url = httptransport + req.headers.host+'/api/offer/getbyid/'+req.params[0];         request.get(url, function (err, res, body) {           resultsobj = json.parse(body);           done(err, resultsobj);         });         },       function (resultsobj, done) {         var httptransport = 'http://';          if (config.secure && config.secure.ssl === true) {           httptransport = 'https://';         }          var url = httptransport + req.headers.host+'/api/shops/'+req.params.shopid+'/'+req.params.locationid;            request.get(url, function (err, res, body) {           var resultsobjnew='';                resultsobjnew = json.parse(body);           done(err, resultsobjnew,resultsobj);         });        },       function (resultsobjnew,resultsobj, done) {          res.render('modules/core/server/views/announcement', {           title: resultsobj[0].title,           imageurl  : resultsobj[0].imageurl,           desc : resultsobj[0].desc,           link:resultsobj[0].redirectlink,           logolink: resultsobjnew.logolink,              backgroundimage:resultsobjnew.backgroundimage             });          }         ]);   }); 

where

  var request = require('request');    var async = require('async');    var path = require('path');     

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -