afasdgag
afasdgag

Reputation: 13

angular ng-route doesn't find a template

Angular ng-route does not find a template but it is included in Dom. I am getting this error:

http://localhost/template/recipes Failed to load resource: the server responded with a status of 404 (Not Found)

in html:

.
.
.
<div class="row">
        <div class="col-lg-6">
            <div ui-view>
                loading...
            </div>
        </div>
    </div>
</div>

<script type="text/ng-template" id="/template/recipes">
    <div class="row">{{title}}<div>
</script>

routeConfig.js:

$urlRouterProvider.otherwise('/recipes');

$stateProvider.state('recipes', {
        url: '/recipes',
        templateUrl: '/template/recipes',
        controller: 'recipesController'
    });

Does anyone know how to solve this issue?

Upvotes: 0

Views: 87

Answers (1)

machinehead115
machinehead115

Reputation: 1657

You forgot to close your div tag in your template. Here is the working plnk.

<script type="text/ng-template" id="/template/recipes">
    <div class="row">{{title}}</div>
</script>

Edit

I also updated the plnk to show the template name with and without an extension.

Upvotes: 1

Related Questions