vendredi 23 décembre 2016

How to use $routeProvider with laravel

I'm trying to use routeProvider in my website which is built in laravel. I have a problem with routeProvider. In one of my page there are some options when user clicks it need to load a template. But when i click on the it is always going to .otherwise Here is my code

(function () {
var academics = angular.module('academics',['ngRoute'])

academics.controller("timeTableController",function($scope){
  $scope.test="Hello world";
})

academics.config(function ($routeProvider)
    {
        $routeProvider
            .when('/timetables',{
                template:"Hello world"
            })
            .when('/plates',{
              template:"Hello Planet"
        })
        .otherwise({
          template:"Good Bye"
        })

    })
})();

This is my blade template

@extends('layout.header')
@include('resources.highcharts')
@include('resources.angular')
@section('content')
<div ng-app="academics" class="col-lg-12">
    <div class="col-lg-4">
      <div class="col-lg-12 option-list">
          <ul class="nav">
            <li class="active"><a  href="#timetables">Exam Timetables</a></li>
          </ul>
      </div>
    </div>
    <div class="col-lg-8">
      <div class="ng-view">

      </div>
    </div>

</div>
@stop

Here when i click on timetables i should get Hello world in my ng-view but I'm not getting it. But the same code is working without laravel. Is there any wrong with my code.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire