I am using Angular with my Django application what I want to do is add a partial to my sheet_form_create.html page. everything works with no errors in my browser console, but for some reason my partial isn't showing up any help would be greatly appreciated.
Here is my add_dim_angular.js
dim_app = angular.module('dim_form', [])
.controller('dim_ctrl', ['$scope', '$compile', function ($scope, $compile) {
$scope.show_dim = function () {
var comp = $compile("<div my-Dim</div>")($scope);
$("#d").append(comp);
};
}])
.directive('my-Dim', function () {
return {
templateUrl: '/sheet/sheet_form_create.html/_dim'
};
});
here is my sheet_form_create.html
{% extends "app/layout.html" %}
{% load crispy_forms_tags %}
{% block content %}
<br />
<br />
<br />
<div class="row" >
{% crispy sheet_form %}
</div>
<body ng-app="dim_form">
<div ng-controller="dim_ctrl">
<a href="#" ng-click="show_dim()">show</a>
<div id="d"></div>
</div>
</body>
{% endblock %}
here is my rendered partial _dim
<html><head></head><body><br>
<br>
<br>
<div class="my-Dim">
<form data-parsley-validate="1" id="dim_new" class="form-horizontal" method="post"> <input name="csrfmiddlewaretoken" value="B3dLOy9inLwzBeuHcR422ePrnCuIaSY4" type="hidden"> <div class="row"> <div class="col-md-2"> <div id="div_id_description" class="control-group"> <label for="id_description" class="control-label requiredField">
Description<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_description" maxlength="255" name="description" parsley-maxlength="255" parsley-minlength="2" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_style" class="control-group"> <label for="id_style" class="control-label requiredField">
Style<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_style" maxlength="255" name="style" parsley-maxlength="255" parsley-minlength="2" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
</div>
<div class="row"> <div class="col-md-2"> <div id="div_id_target" class="control-group"> <label for="id_target" class="control-label requiredField">
Target<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_target" name="target" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_upper_limit" class="control-group"> <label for="id_upper_limit" class="control-label requiredField">
Upper limit<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_upper_limit" name="upper_limit" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_lower_limit" class="control-group"> <label for="id_lower_limit" class="control-label requiredField">
Lower limit<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_lower_limit" name="lower_limit" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
</div>
<div class="row"> <div class="col-md-2"> </div>
<div class="col-md-2"> <div id="div_id_critical" class="control-group"> <label for="id_critical" class="control-label requiredField">
Critical<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_critical" name="critical" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_units" class="control-group"> <label for="id_units" class="control-label requiredField">
Units<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_units" maxlength="255" name="units" parsley-maxlength="255" parsley-minlength="2" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_metric" class="control-group"> <label for="id_metric" class="control-label requiredField">
Metric<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_metric" maxlength="255" name="metric" parsley-maxlength="255" parsley-minlength="2" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
</div>
<div class="row"> <div class="col-md-2"> <div id="div_id_target_strings" class="control-group"> <label for="id_target_strings" class="control-label requiredField">
Target strings<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_target_strings" maxlength="255" name="target_strings" parsley-maxlength="255" parsley-minlength="2" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_ref_dim_id" class="control-group"> <label for="id_ref_dim_id" class="control-label requiredField">
Ref dim id<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_ref_dim_id" name="ref_dim_id" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_nested_number" class="control-group"> <label for="id_nested_number" class="control-label requiredField">
Nested number<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_nested_number" name="nested_number" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_position" class="control-group"> <label for="id_position" class="control-label requiredField">
Position<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_position" name="position" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
</div>
<div class="row"> <div class="col-md-2"> <div id="div_id_met_upper" class="control-group"> <label for="id_met_upper" class="control-label requiredField">
Met upper<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_met_upper" name="met_upper" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_met_lower" class="control-group"> <label for="id_met_lower" class="control-label requiredField">
Met lower<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_met_lower" name="met_lower" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_valc" class="control-group"> <label for="id_valc" class="control-label requiredField">
Valc<span class="asteriskField">*</span> </label> <div class="controls"> <input class="textinput textInput" id="id_valc" name="valc" parsley-required="true" parsley-required-message="This field is required." type="text"> </div> </div> </div>
<div class="col-md-2"> <div id="div_id_sheet_id" class="control-group"> <label for="id_sheet_id" class="control-label requiredField">
Sheet id<span class="asteriskField">*</span> </label> <div class="controls"> <input class="numberinput" id="id_sheet_id" name="sheet_id" parsley-required="true" parsley-required-message="This field is required." parsley-type="digits" parsley-type-message="Enter a whole number." type="number"> </div> </div> </div>
</div>
<br> <br><div class="form-actions"> <input name="save_dims" value="Save Dims" class="btn btn-primary btn-primary" id="submit-id-save_dims" type="submit">
<a class="btn btn-danger" href="/sheet/sheet_form_create.html">Cancel</a>
</div> </form>
</div>
</body></html>
Aucun commentaire:
Enregistrer un commentaire