javascript - Angularjs directive not showing -


i started angularjs , trying build directive.
js file:

 var app = angular.module('mycars',['ngresource']);   app.controller('carcontroller', function (post) {         var b = post.query(function () {             console.log(all);         });         this.cars = b; });         app.directive("carcritics", function () {                 return {                     restrict: 'e',                     templateurl: '~/views/home/car-critics.cshtml'                 };             }); 

in cshtml file looks this:

<car-critics></car-critics> 

i have read lots of documentations in internet directives , can´t see doing wrong. anytime start application part in directive isn´t showing. appriciate type of help.

you dont straight away grab .cshtml views folder. must create actionresult , return "car-critics.cshtml", so:

public class homecontroller     {         public actionresult carcritics() {              return view("car-critics");         } } 

and directive should be:

app.directive("carcritics", function () {         return {             restrict: 'e',             templateurl: '/home/carcritics'         };     }); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -