how to use angular module 'ui-route' to find the templateUrl inside a directive and not get an error on MVC .NET""NetworkError: 403 Forbidden - http://www.myapp.com/~/App/XV-Directives/form-input-text-template.vbhtml"
1 solution: Here is an answer with out using the angular 'ui-rout' using the webconfig of the MVC project ClickHere ; this solution allows anyone to see your application file
var xvFormCreator = function () {
//pass the template name and the data source of the template
return {
restrict: 'EA',
scope: {
sourceData: '=',
},
templateUrl: '~/App/XV-Directives/form-input-text-template.vbhtml'
};
};
// html template string form
/* ' <div class="form-group">' +
'<div class="col-md-6">' +
'<label class="text-info">{{ sourceData.Qestion }} :</label>' +
'</div>' +
'<div class="col-md-6">' +
'<textarea' +
' name="{{ sourceData.Qestion }} "' +
' class="form-control"' +
' rows="1"'+
' placeholder="{{sourceData.TemplateType }}"' +
' value="{{ sourceData.Answer }}"></textarea>' +
'</div>' +
' </div>'
html template
<div class="form-group">
<div class="col-md-6">
<label class="text-info">{{ sourceData.Qestion }} :</label>
</div>
<div class="col-md-6">
<input name="{{ sourceData.Qestion }} "
class="form-control"
type="text"
placeholder="{{sourceData.TemplateType }}"
value="{{ sourceData.Answer }}" />
</div>
</div>*/
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>