angularjs - Angular expressions not working in HTML template -
i working on to-do app using mean stack using different view templates. 1 supposed loaded on request #/home/{task_id}
in app.factory wrote:
var t = { tasks: [ //{text: 'add first task', note: '', high: true} ] }; t.getone = function(id) { return $http.get('/home/' + id).then(function(res){ return res.data; }); };
the controller declared as:
app.controller('tasksctrl',['$scope','tasks','task',function($scope,tasks,task) { $scope.task = task; }]);
and in app.config have (using ui-router):
$stateprovider .state('tasks', { url: '/home/{id}', templateurl: '/tasks', controller: 'tasksctrl', resolve: { task: ['$stateparams','tasks',function($stateparams,tasks) { return tasks.getone($stateparams.id); }] } });
additionally, in routes/index.js
router.route('/home/:task_id') .get(function(req, res, next) { task.findbyid(req.params.task_id).find(function(err, task) { if(err){ return next(err); } res.json(task); }); })
mongoose schema:
var taskschema = new mongoose.schema({ text: string, note: string, high: boolean });
i still seem missing expressions {{task.text}} not evaluated
Comments
Post a Comment